我在 stackexchange 上看到过其他示例,但似乎无法使它们适应我的代码。
问题:我有一个包含 .rds 文件的文件夹,我想将其读入 R,然后将所有文件堆叠在一起,以便我可以获取平均值和标准差。当引入 R 时,所有 .rds 文件都是“正式类 RasterLayer”(如果相关的话)。
示例代码:
# file path to folder where .rds files are stored
path = "~/Predictions/"
# create place to store files
stack <-""
# create vector of all .rds files in folder
pred.dates <- dir(path, pattern =".rds")
# loop to bring in each .rds file
for(i in 1:length(pred.dates)){
file <- readRDS(file.names[i],".rds")
stack <- rbind(stack, file)
}
# take mean of all .rds files stacked together and plot
pred_mean <- …Run Code Online (Sandbox Code Playgroud) 我有离开和到达鸟类的时间数据(例如到达17:23:54).我想将数据分成2小时的时间段(例如0:00:00-1:59:59 ......等),共12个箱.数据最终将进入条形图,其中x轴上有时间段,y轴上有计数.包裹'binr'会是我最好的选择吗?
谢谢