Error in cut.default(x,breaks=breaks,include.lowest=T):'x'must be numeric 解决办法 使用lapply函数将X变为数值型即可轻松解决问题。 TRSN.F1<-read.delim("C:/Users/Desktop/TRSN-F1.txt",encoding="UTF-8",row.names=1)##数据处理heatmap_data1_num<-as.data.frame(lapply(TRSN.F1,function(x...
Error in adf.test(data) : 'x' must be a numeric vector or univariate time series 我们先查看数据和adf.test()函数的帮助文档。 用head()函数查看数据,发现我们的数据是二维的,包含日期和收益率两个变量。 用class()函数查看,发现数据是data.frame格式。 > head(data) # A tibble: 6 × 2 Trddt d...
你只需要用as.numeric来转变你需要那一行的数据就行了。举个例子:#首先建一个有30个数值的vector tes...
这个错误是在使用read.table()函数读取文件遇到的,经过摸索,发现read.table()读取的数据类型为data.frame, 通过将y的类型由data.frame转换为vector可解决报错。 ###将data.frame数据类型转换为vector数据类型 y<-as.vector(as.matrix(y)) 以后遇到数据类型类的报错问题,可借助下面思路尝试解决: 1.使用class()...
报错信息二:Error in heatmap.default(x = data, …) : ‘x’ must be a numeric matrix 这个报错信息同样出现在调用heatmap函数或heatmap.2函数时。它表示输入的矩阵数据不是数值型的。热图函数要求输入的矩阵数据必须是数值型的,否则无法进行绘图。解决这个问题的方法是确保输入的数据类型正确,可以使用as.numer...
产生报错:rowMeans(new1) : 'x' must be an array of at least two dimensions 把命令改为如下即可解决: new1$mean=apply(as.data.frame(new1),1,mean)new1$mean=rowMeans(new1) 注意,使用行计算平均值时,需要将"matrix"转为"data.frame",不可以直接用data.frame()函数,需要用as.data.frame()函数...
错误: Each row of output must be identified by a unique combination of keys. Keys are shared for 600 rows: 查了下解释如下: The error in spread can occur when there are more than one unique combinations exist. With pivot_wider, it is now replaced with a warning and would return a list...