我想使用data.frames包对存储在list中的许多单独的akima进行内插。
拆分了我的原始数据框架:
store <- split(data, data$frameID)我试过这个..。
results <- lapply(store, interp, x = lon, y = lat, z = precip)但是我得到了错误消息Error in interp(x = lon, y = lat, z = precip) : object 'lat' not found。
单个结果可以是成功地生成,下面是。
results <-list() # create and empty list for results
results[[i]]<-with(store$`600`, interp(x = lon, y = lat, z = precip)).其中600表示列表中的data.frames之一的名称。
但是,试图使用循环方法将其推广到整个列表。
i=1
for (i in i:length(store)){
results[[i]]<-with(store$`i`, interp(x = lon, y = lat, z = precip))
}我再次收到Error in interp(x = lon, y = lat, z = precip) : object 'lat' not found。
如有任何建议,将不胜感激。
发布于 2016-11-05 21:30:33
使用建议,并说明重复的点(相同的lat和lon的一些站),这是做的工作。
i=1
for (i in i:length(store)){
results[[i]]<-with(store[[i]], interp(x = lon, y = lat, z = precip,
duplicate = "mean"))
}https://stackoverflow.com/questions/40439822
复制相似问题