在R中的多个csv文件中查找最大列值

时间:2019-02-04 22:40:09

标签: r csv minimax

谢谢阅读。

我正在尝试从2个CSV文件的数据中查找一列的最大值(请参见下面的文件示例)。

不确定如何找到特定列的最大值(tp,)

1 个答案:

答案 0 :(得分:1)

合并两个文件并查找最大值。

df1 <- read.csv("Path to the file1", header=T, sep=",")
df2 <- read.csv("Path to the file2", header=T, sep=",")
data <- rbind(df1,df2)
max(data['temp'])

如果您有很多文件,

setwd('Path of the folder that contains the files')   
filenames <- list.files(full.names=TRUE)
data <- lapply(filenames,function(i){read.csv(i)})
df <- do.call(rbind.data.frame, data)
max(df['temp'])