我对 R 比较陌生。我正在将多个 csv 文件中包含的数据合并到一个动物园对象中。
这是我的 for 循环中的代码片段:
temp <- read.csv(filename, stringsAsFactors=F)
temp_dates <- as.Date(temp[,2])
temp <- zoo(temp[,17], temp_dates)
dataset <- temp[seq_specified_dates]
# merge data into output
if (length(output) == 0)
output <- dataset
else
output <- merge(output, dataset, all=FALSE)
当我在输出动物园对象上运行 head() 时,我注意到奇怪的列名,例如:'dataset.output.output.output' 等。如何为合并的列分配更有意义的名称。?
另外,如何引用动物园对象中的特定列?例如,如果输出是一个数据框,我可以将“Patient_A”列引用为 output$Patient_A。如何引用合并的动物园对象中的特定列?