'min'对因素没有意义

时间:2017-12-19 23:14:39

标签: r

Exchange_rate <-read.csv("Exchange.csv")

str(Exchange_rate)

summary(Exchange_rate)
weekdays = data.frame(wdy =c("Thu","Fri","Mon","Tue","Wed"),x =runif(5),y =runif(5))

summary(Exchange_rate$forecast)

library(ggplot2)
library(reshape2)
library(gridExtra)

min(as.character(as.numeric(Exchange_rate$YYYYMMDD)), na.rm=TRUE)

normalize<-function(x){return((x-min(x))/(max(x)-min(x)))}

exchangeN<-as.data.frame(lapply(Exchange_rate, normalize)) //ERROR AT THIS LINE

summary(exchangeN)

我收到以下错误

  

exchangeN&lt; -as.data.frame(lapply(Exchange_rate,normalize))Summary.factor中的错误(c(115L,117L,120L,122L,124L,125L,126L,130L,:'min'没有意义因素

为什么我得到这个以及如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

lapply(Exchange_rate, normalize)lapply(as.list(Exchange_rate), normalize)相同;它将normalize应用于每一列。其中一列是一个因素。 str应该告诉你哪一个。