fields:::Krig.engine.default
中使用的eigen
函数内部的.Internal(La_rs(x,FALSE))
调用导致我的R控制台[1]在大型脚本期间触发后崩溃。
我敢肯定,这就是导致爆炸的那条线。 但是,使用以下命令,同一行不会在全新会话上崩溃:
x <- structure(c(0.00251355321405019, -0.000589785531216647, -0.000172411748626129, -0.000589785531217227, 0.000897505637785858, -0.000714600035538855, -0.000172411748626269, -0.000714600035538766, 0.00123946691634644), .Dim = c(3L, 3L))
.Internal(La_rs(x,FALSE))
您可以使用以下三行重现此控制台崩溃(大约需要十分钟):
# install.packages( c("MonetDB.R", "MonetDBLite" , "survey" , "SAScii" , "descr" , "downloader" , "digest" , "sas7bdat" , "R.utils" ,"survey","ggplot2","scales","mapproj","sqldf","maptools","raster","rgeos","stringr","plyr","mgcv","spatstat","rgeos") , repos=c("http://dev.monetdb.org/Assets/R/", "http://cran.rstudio.com/"))
# path.to.7z <- "7za" # macintosh/unix users need to specify 7z
# setwd("C:/My Directory/")
# warning: some large downloads
downloader::source_url( "https://raw.githubusercontent.com/davidbrae/swmap/8eecde1683efab65a7e27eb7c92e7967a98dc639/how%20to%20map%20the%20american%20community%20survey.R" , prompt = FALSE )
抱歉,这个例子不是更小,当我删除不同的东西时崩溃消失了。
2016年2月22日编辑:更糟糕的是,当我尝试一个旨在自行触发崩溃的脚本时,它不会死!
downloader::source_url("https://gist.githubusercontent.com/ajdamico/0c256ed3a77d77eecfd6/raw/ce0570effd37c6384f2e27f1b38335078adcb49d/La_rs_bughunt.R",echo=T,prompt=F)
谢谢!
[1] R 版本 3.2.3 (2015-12-10) 平台: x86_64-w64-mingw32/x64 (64 位)
如果我一次运行整个脚本,R 会在 Rterm.exe 中没有任何信息的情况下崩溃。 但是如果我将脚本分成两部分,R 会给我此错误:
> x
[,1] [,2] [,3]
[1,] 0.0025135532 -0.0005897855 -0.0001724117
[2,] -0.0005897855 0.0008975056 -0.0007146000
[3,] -0.0001724117 -0.0007146000 0.0012394669
> .Internal(La_rs(x,TRUE))
Error: 'a' must be a complex matrix
更多调试信息:它看起来像.内部()函数La_rs
以某种方式被破坏了?
> debug::mtrace(.Internal(La_rs(x,TRUE)))
Error in debug::mtrace(.Internal(La_rs(x, TRUE))) :
Dunno wot to do with .Internal(La_rs(x, TRUE))
> x
[,1] [,2] [,3]
[1,] 0.0025135532 -0.0005897855 -0.0001724117
[2,] -0.0005897855 0.0008975056 -0.0007146000
[3,] -0.0001724117 -0.0007146000 0.0012394669
> class(x)
[1] "matrix"
> .Internal(La_rs(x,FALSE))
Error: 'a' must be a complex matrix
> .Internal(La_rs(x,TRUE))
Error: 'a' must be a complex matrix
> .Internal(La_rs(1,TRUE))
Error: 'a' must be a complex matrix
> .Internal(La_rs(matrix(1,2,3,4),TRUE))
Error: 'a' must be a complex matrix
<小时 />2016年2月21日更新:我能够在第二个Windows脚本上重现此错误(没有R死亡)。 这是永久链接
# install.packages( c( 'fields' , 'maps' , 'ggplot2' , 'raster' , 'sqldf' , 'rgeos' , 'rgdal' , 'sp' , 'digest' , 'ff' , 'descr' , 'SAScii' , 'stringr' , 'R.utils' , 'R.oo' , 'RCurl' , 'MonetDBLite' , 'MonetDB.R' , 'survey' , 'downloader' ) , repos=c("http://dev.monetdb.org/Assets/R/", "http://cran.rstudio.com/"))
# setwd( "S:/temp/PNAD" )
# warning: some large downloads
downloader::source_url( "https://raw.githubusercontent.com/davidbrae/swmap/4501e2c8927faaffa02c92d3e40d16beb44bca92/how%20to%20map%20the%20pesquisa%20nacional%20por%20amostra%20de%20domicilios.R" , echo = TRUE , prompt = FALSE )
这是在错误点发生时发生的情况。 再次La_rs
似乎已损坏。
> for ( i in 1:4 ){
+
+ this.krig.fit <-
+ Krig(
+ cbind( x$x , x$y ) ,
+ x[ , paste0( 'occcat' , i ) ] ,
+ weights = x[ , paste0( 'weigh .... [TRUNCATED]
Error in eigen(tempM, symmetric = TRUE) : 'a' must be a complex matrix
In addition: There were 50 or more warnings (use warnings() to see the first 50)
> traceback()
8: eigen(tempM, symmetric = TRUE)
7: Krig.engine.default(out, verbose = verbose)
6: Krig(cbind(x$x, x$y), x[, paste0("occcat", i)], weights = x[,
paste0("weight", i)]) at filee101515cee#676
5: eval(expr, envir, enclos)
4: eval(ei, envir)
3: withVisible(eval(ei, envir))
2: source(temp_file, ...)
1: downloader::source_url("https://raw.githubusercontent.com/davidbrae/swmap/master/how%20to%20map%20the%20pesquisa%20nacional%20por%20amostra%20de%20domicilios.R",
echo = T, prompt = F)
> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows Server 2008 R2 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] tcltk grid stats graphics grDevices utils datasets methods base
other attached packages:
[1] fields_8.3-6 maps_3.1.0 spam_1.3-0 ggplot2_2.0.0 raster_2.5-2
[6] sqldf_0.4-10 RSQLite_1.0.0 gsubfn_0.6-6 proto_0.3-10 rgeos_0.3-17
[11] rgdal_1.1-3 sp_1.2-2 digest_0.6.9 ff_2.2-13 bit_1.1-12
[16] descr_1.1.2 SAScii_1.0 stringr_1.0.0 R.utils_2.2.0 R.oo_1.19.0
[21] R.methodsS3_1.7.0 RCurl_1.95-4.6 bitops_1.0-6 MonetDBLite_0.2.0 MonetDB.R_1.0.1
[26] DBI_0.3.1 survey_3.30-3 downloader_0.4
loaded via a namespace (and not attached):
[1] Rcpp_0.12.3 plyr_1.8.3 tools_3.2.3 gtable_0.1.2 lattice_0.20-33
[6] magrittr_1.5 scales_0.3.0 codetools_0.2-14 xtable_1.8-0 colorspace_1.2-6
[11] stringi_1.0-1 munsell_0.4.2 chron_2.3-47
>
二月27th,2016编辑:非常相似的错误,在此脚本中间添加gc()
可以防止崩溃
# account creation page
# http://www.icpsr.umich.edu/rpxlogin?path=NACJD&request_uri=https%3a%2f%2fwww.icpsr.umich.edu%2ficpsrweb%2fNACJD%2f
your.username <- 'email@address.com'
your.password <- 'some_password'
setwd( "C:/My Directory/NCVS_BUG/" )
library(downloader)
source_url( "https://gist.githubusercontent.com/ajdamico/4cd5f76aebbdaae5bc88/raw/1ae140e84aa82f1c12af297badad6d8c2c50f5a1/ncvs_bughunt.R" , echo = TRUE , prompt = FALSE )
哇,这个错误很难重现。 重现所需的步骤数可能是您没有很多答案的原因。
我终于设法下载了所有数据并安装了要重现的软件包,但是还没有获得您的代码(相当复杂)来达到您指示它尚未失败的程度。
根据我所做的评论,错误消息表明lapack
正在尝试执行您正在使用的函数的复杂版本(此行引发的错误),但输入变量的类型不是矩阵,因此它会触发错误。 这很可能是低级别的根本原因。
但是,您可能真正想要答案的问题是,为什么会发生这种情况?
我怀疑这意味着您的一个步骤的输入数据要么是空的,要么是一维的。 我将继续尝试重现以证明这一理论。