我使用的是 Windows 7,并且使用 R Studio 0.99.902 和 R3.3.1。当我尝试安装软件包时,我收到警告:
Warning: unable to access index for repository http://cran.rstudio.com/src/contrib:
cannot open URL 'http://cran.rstudio.com/src/contrib/PACKAGES'
Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib:
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'
Run Code Online (Sandbox Code Playgroud)
这是我第一次看到它,我无法解决它。谁能帮我 ?
我有一个大的列表(A)的SpatialPolygonsDataFrames列表.某些列表具有空值(表示没有SpatialPolygonsDataFrame).我试过了 :
A[!sapply(unlist(A, recursive=FALSE), is.null)]
Run Code Online (Sandbox Code Playgroud)
但没有结果,然后我尝试:
A_nonulls=lapply(A, na.omit)
Run Code Online (Sandbox Code Playgroud)
删除较大列表中每个列表的null的正确方法是什么?
编辑:
我不能做str(A)因为A有1000个列表并且很大.第一个列表中的第一个元素如下:
[[1]]
NULL
[[2]]
NULL
[[3]]
NULL
[[4]]
NULL
[[5]]
class : SpatialPolygons
features : 1
extent : 722951.5, 726848.9, 4325874, 4329654 (xmin, xmax, ymin, ymax)
Run Code Online (Sandbox Code Playgroud)
所以我想删除空值并仅保留非空元素.
我有一个大的多边形数据集,并且通过循环,我尝试在某个时刻查找、计算和存储交点。在第 870 次迭代时,循环停止并出现错误:
Error in RGEOSBinTopoFunc(spgeom1, spgeom2, byid, id, drop_lower_td, unaryUnion_if_byid_false, :
TopologyException: Input geom 0 is invalid: Ring Self-intersection at or near point 26.437120350000001 39.241770119999998 at 26.437120350000001 39.241770119999998
Run Code Online (Sandbox Code Playgroud)
我使用traceback()但我实际上无法理解它:
4: .Call("rgeos_intersection", .RGEOS_HANDLE, spgeom1, spgeom2,
byid, ids, PACKAGE = "rgeos")
3: RGEOSBinTopoFunc(spgeom1, spgeom2, byid, id, drop_lower_td, unaryUnion_if_byid_false,
"rgeos_intersection")
2: gIntersection(combinations[[i]][[1, m]], combinations[[i]][[2,
m]]) at #17 . Can anyone explain what to look in ` traceback`?
Run Code Online (Sandbox Code Playgroud)
谁能解释一下该看什么traceback?
谢谢
我有一个数据框,如下所示:
a = c("1A","10A","11A","2B","2C","22C","3A","3B")
b= c(1,2,3,4,5,6,7,8)
ab = data.frame(a,b)
Run Code Online (Sandbox Code Playgroud)
我想根据列排序a。我尝试了混合订单
library(gtools)
ab[mixedorder(ab$a),]
Run Code Online (Sandbox Code Playgroud)
但我没有得到我想要的结果(1A,2B,2C,3A,3B..)。我怎样才能解决这个问题?