I'm trying to plot a raster using the "raster" package but I'm running against an error
Here's my code
map = raster("A055E.tif")
plot(map)
Error in `colnames<-`(`*tmp*`, value = "A055E") :
length of 'dimnames' [2] not equal to array extent
sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: i386-w64-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rgdal_0.9-1 raster_2.3-0 sp_1.0-15
loaded via a namespace (and not attached):
[1] grid_3.1.1 lattice_0.20-29 tools_3.1.1
However, when I run it on a linux machine with the following versions:
R version 3.1.1 (2014-07-10)
Platform: i686-pc-linux-gnu (32-bit),
raster_2.2-31 sp_1.0-15)
it doesn't give me an issue
I think that if you update the raster package things will work again.
On windows computer I had similar problem - I couldn't plot 3-band raster map using plotRGB(). The solution was to handly remove package 'raster' and just install it again.
Related
I need to obtain user input from the svDialogs R package, e.g. using svDialogs::dlgInput(). However, attempting to do this without attaching the package with library() or require() gives an error:
svDialogs::dlgInput("Example")
Error in svDialogs::dlgInput("Example") : attempt to apply non-function
The following works fine:
library(svDialogs)
svDialogs::dlgInput("Example")
Why might this be, and what might be a way around it? I have the current CRAN version of the package (0.9.57).
Update
I have tried installing previous versions of svDialogs, as well as comparing my code with the source code from the cgam package, which depends on svDialogs. Currently the entire svDialogs package is imported in my NAMESPACE, which is how it is used in cgam. But I still get the same error unless I first run library(svDialogs). Any tips?
Update 2
I also imported the entire svGUI package in my NAMESPACE, with no luck.
sessionInfo() R version 3.4.3 (2017-11-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
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] stats graphics grDevices utils
datasets methods base
other attached packages: [1] svDialogs_0.9-57 svGUI_0.9-55
loaded via a namespace (and not attached): [1] compiler_3.4.3
tools_3.4.3
I've recently updated my Windows machine and reinstalled R3.4.0 (64bit) and igraph 1.0.1. I've previously used igraph in combination with FCMapper and it's worked perfectly.
On the new machine I keep getting the following error, even with code that previously worked without a hitch:
Error in base::.Call("R_igraph_check_finally_stack", PACKAGE =
"igraph") : "R_igraph_check_finally_stack" not available for
.Call() for package "igraph"
Error in base::.Call(.NAME, ...) : "R_igraph_finalizer" not
available for .Call() for package "igraph"
I've had a google and the previous responses indicate that it's a NAMESPACE error in the current version of the package. Any help would be appreciated!
sessionInfo()
R version 3.4.0 (2017-04-21) Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale: [1] LC_COLLATE=English_United Kingdom.1252
LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United
Kingdom.1252 [4] LC_NUMERIC=C
LC_TIME=English_United Kingdom.1252
attached base packages: [1] stats graphics grDevices utils
datasets methods base
other attached packages: [1] igraph_1.0.1 FCMapper_1.1
loaded via a namespace (and not attached): [1] compiler_3.4.0
magrittr_1.5 tools_3.4.0
I want to read more details about the new function in data.table v 1.8.11, after reading the link
I tried ?melt.data.table as pointed in the above link.
But there's no documents..
No documentation for melt.data.table?in specified packages and libraries:
you could try ??melt.data.table?
Here's my sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] data.table_1.8.11
Did I miss something?
EDIT On Jan20 2014
** Problems Still Not Solved**
I tried unistalled the data.table and deleted the library directory.
And then installed using the precompiled for windows in this link
> install.packages("~/Downloads/data.table_1.8.11.zip", repos = NULL)
Warning in install.packages :
package 憕/Downloads/data.table_1.8.11.zip?is not available (for R version 3.0.2)
Installing package into 慍:/Users/James/R/win-library/3.0?(as 憀ib?is unspecified)
package 慸ata.table?successfully unpacked and MD5 sums checked
The sessionInfo() is the same after reinstalling, and I put all the information here.
Still the ?melt.data.table not working.
[Edit by Matt] In turns out the data.table homepage was misleading (now fixed) and the Windows .zip on that page was 5 months old.
The correct way to install from R-Forge is
install.packages("data.table", repos="http://R-Forge.R-project.org").
Then the problem is solved and the documentation for ?melt.data.table is available.
Sorry this belongs in a comment but it's too long...
You might want to try re-installing data.table 1.8.11 (I found it here). When I do that, then start a new R session and:
library(data.table)
# data.table 1.8.11 For help type: help("data.table")
sessionInfo()
# R version 3.0.2 (2013-09-25)
# Platform: x86_64-w64-mingw32/x64 (64-bit)
#
# locale:
# [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
# [4] LC_NUMERIC=C LC_TIME=English_United States.1252
#
# attached base packages:
# [1] stats graphics grDevices utils datasets methods base
#
# other attached packages:
# [1] data.table_1.8.11
#
# loaded via a namespace (and not attached):
# [1] plyr_1.8 reshape2_1.2.2 stringr_0.6.2 tools_3.0.2
Note the bit at the end. It looks like data.table 1.8.11 loads reshape2, which probably contains melt.data.table(...). Did you truncate your sessionInfo, or were they not loaded?
More of a curiosity but when you use q or quit inside of a function inside of R studio it causes a fatal error as seen here:
But the same function in rgui causes R to stop as usual. And using just q() in RStudio closes R as expected. Why does q in a function cause RStudio to literally bomb? Is this a local issue? Can others replicate it?
Example function that causes the bomb:
FUN <- function() q()
FUN()
Here's my sessionInfo:
R Under development (unstable) (2013-09-04 r63830)
Platform: i386-w64-mingw32/i386 (32-bit)
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] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.1.0
RStudio Version 0.97.551
I'm having an issue with R Studio crashing when I run the Crosstable function. First, I'm installing the following packages:
install.packages ("gmodels"); install.packages("MASS")
library (gmodels); library (MASS)
Then, I run the following code on my data frame:
CrossTable(dat$PopSize, dat$PCIncChange, fisher = TRUE, chisq = TRUE)
expected = TRUE, sresid = TRUE, format="SPSS")
R produces the table, but then does not allow me to execute any other code in the console. It also doesn't allow me to save my file or quit the program (I've had to use control alt delete every time).
-- Edit: Adding session info from comments --
sessionInfo():
R version 2.15.2 (2012-10-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
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] splines stats graphics grDevices utils datasets methods base –
other attached packages: [1] MASS_7.3-23 gmodels_2.15.3 Hmisc_3.10-1 survival_2.36-14 stringr_0.6.2
loaded via a namespace (and not attached): [1] cluster_1.14.3 gdata_2.12.0 grid_2.15.2 gtools_2.7.0 lattice_0.20-10 tools_2.15.2
Any ideas?