Splitting a Table Without Hardcoding While a graduate student was reviewing our code, it was suggested that we not hardcode our NYSE data as that could result in problems. Is
this an issue likely to arise in the grading of our final project? If so, does this code make sense?:
x <- nrow(stocks.imp)/3
BasetableTRAIN <- stocks.imp[1:x,] #nrow/3 rather than hard-code
BasetableVAL <- stocks.imp[x+1:x*2+1,]
BasetableTEST <- stocks.imp[x*2+2:x*3+2,]
BasetableTRAINbig <- rbind(BasetableTRAIN,BasetableVAL)
Answers and follow-up questions Answer or follow-up question 1
The graduate student is correct. Your solution is also correct. This is consistent with what we have been doing in the book too.
Never hardcode anything.
Michel BallingsSign in to be able to add an answer or mark this question as resolved.