我有几个数据集,我想为每个数据集制作一些具有统计数据的新数据框。
我的数据集的名称是:
01P004
01P005
01P006
etc.
这是数据的样子:
description result_timestamp water_level_validation_measurement
1 98P001 2013-01-02 12:00:00 2.49
2 98P001 2013-02-26 12:00:00 1.10
3 98P001 2013-03-14 12:00:00 1.09
4 98P001 2013-03-28 12:00:00 1.08
5 98P001 2013-04-10 12:00:00 1.04
6 98P001 2013-04-22 12:00:00 0.99
所以我创建了一个for循环来遍历数据集
Files <- mget(ls(pattern='*[0-9][0-9][A-Z][0-9][0-9][0-9]*'))
for (i in 1:length(Files)){
paste0("Stat", names(Files[i])) <- Files[[i]] %>%
group_by(Files[[i]]$description)) %>%
summarise(GG = mean(Files[[i]]$water_level_validation_measurement),
RHG = quantile(Files[[i]]$water_level_validation_measurement, .9),
RLG = quantile(Files[[i]]$water_level_validation_measurement, .1))
}
但是我在查找有效代码时遇到了一些麻烦。这给出了以下错误
Error in paste0("Stat", names(Files[i])) <- Files[[i]] %>% group_by(Files[[i]]$description) %>% :
target of assignment expands to non-language object
有人知道如何解决此问题吗?
非常感谢!