as a new R user I got a lot of doubts and need some help.
I loaded my sheet from excel using the following function, xlsx, however All my data comes as a factor. Why all my data had been loaded as a factor.
I tried to use the packdge varhandle and use the function unfactor and transform everything in numeric vector using the lapply function, but didn't work.
##Choose a specifc set of cells
Data <- read.xlsx(Master_df, sheetName = "PLANILHA_FINAL", startRow = 3,
endRow = 141, colIndex = 3:40, header = T)
#1th attempt
Data <- as.numeric(unfactor(Data))
#2th attempt
Data <- unfactor(Data)
Data <- as.numeric(Data)
Data[6:38] <- lapply(Data, as.numeric)
Data$GRUPO <- as.factor(Data$GRUPO)
Data$MOMENTO <- as.factor(Data$MOMENTO)