I went through similar questions but I still could not sort my problem out. Anyway, I have a data-frame (size:36*42) that contains numbers while in the last row (36'th row) it has the dates for each column. I wanted to normalize the columns of this data-frame (the whole data-frame except the last row) using the following function:
normalize<-function(x){return((x-min(x, na.rm=TRUE))/(max(x, na.rm=TRUE)-min(x, na.rm=TRUE)))}
but I always get this error:
Error in x - min(x, na.rm = TRUE) : non-numeric argument to binary operator
The thing that I have tried
as.data.frame(lapply(df[c(1:nrow(df)-1),], normalize))
BTW, when I check the typeof(df)
it shows that the df
is a list
but when I check it using is.list(df)->TRUE
and also is.data.frame(df)->TRUE
, which it makes me confuse.
Thanks