subset - R: Undefined Columns Selected Error when Subsetting DF -
i have dataframe data following structure:
classes ‘tbl_df’ , 'data.frame': 4391 obs. of 53 variables
when try subset top 100 rows using
data100 = data[1:100,]
i error:
error in `[.data.frame`(x[[i]], ...) : undefined columns selected
what reason?
found answer - needed use
as.data.frame(data)
before subsetting because tbl_df not subsettable same way data frame. needed due using dplyr earlier , outputting table instead of df.
Comments
Post a Comment