I have a large-ish data frame (100k Row x 50 Col) with several factor variables. I want a small subset (like 100 rows) to do some prototyping with. The problem is when I type :
train <- train[1:100,]
the size shrinks (using dim()
) but it still appears to store all the factors from the original data frame (I'm measuring memory size using lsos()
found here).
Is there a way to get around this? So far the only way I've found is to turn the factor variables to character strings then subset, then convert to factors again. I feel like there has to be a better way to do this.
Any suggestions?