I have recently updated RStudio to 3.3.1, and since then, when I run the following code using dplyr, R tells me "This application has requested the Runtime to terminate it in an unusual way".
max_trop <- df %>% group_by(record_id) %>% summarise(max= max(troponin, na.rm=TRUE))
Would anyone be able to tell me if I'm doing something particularly stupid? It used to work fine...
Many thanks
sessionInfo()
R version 3.3.1 (2016-06-21)Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:[1] LC_COLLATE=English_United Kingdom.1252
LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dplyr_0.5.0
loaded via a namespace (and not attached):
[1] magrittr_1.5 R6_2.1.2 assertthat_0.1 DBI_0.4-1
tools_3.3.1 tibble_1.1 Rcpp_0.12.6
This can be caused by getting the wrong variable names in a dplyr chain. The solution is to check what you're providing in the variables exists in your data set.
data("mtcars")
library(dplyr)
# Runs
mtcars %>% summarise(mean(mpg))
# crashes with message 'This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.'
mtcars %>% summarise(mean(mag))
Related
I am trying to use this tutorial https://github.com/wvictor14/planet#infer-ethnicity and get the following error message, even when using the test data provided:
pl_infer_ethnicity(pl_betas)
[1] "1860 of 1860 predictors present."
Loading required package: Matrix
Error: 'glmnet_softmax' is not an exported object from 'namespace:glmnet'
I've tried re-installing individual packages and running in a new version or R and get the same error. I believe this is related to other errors posted with a recent update in glmnet. Any tips on how to resolve?
sessionInfo()
R version 3.6.2 (2019-12-12)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] 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] Matrix_1.2-18 planet_0.1.0
loaded via a namespace (and not attached):
[1] lattice_0.20-38 codetools_0.2-16 glmnet_3.0-2 foreach_1.4.7
[5] crayon_1.3.4 grid_3.6.2 magrittr_1.5 pillar_1.4.2
[9] rlang_0.4.2 remotes_2.1.0 iterators_1.0.12 tools_3.6.2
[13] compiler_3.6.2 pkgconfig_2.0.3 shape_1.4.4 tibble_2.1.3
I don't know why it would have worked in the first place; the NEWS file for glmnet doesn't say anything one way or the other about glmnet_softmax (e.g., it does not say "glmnet_softmax is no longer exported" or anything like that ...)
In any case, this is a non-exported function from the glmnet package. It is referred to here in the tutorial code.
If you can change that line of code to refer to glmnet:::glmnet_softmax (i.e., three colons rather than two), that should suffice (::: allows you to access a non-exported function).
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 have used fread to read data. But the error has arisen:
showProgress is not type integer but type 'logical'. Please report.
Here is the reproducible script:
library(data.table)
x <- "sgsddsfsfsf"
write.csv2(x,"check.csv", row.names=FALSE)
fread("check.csv", stringsAsFactor=FALSE)
Example of printscreen:
> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
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] data.table_1.9.8
loaded via a namespace (and not attached):
[1] tools_3.3.2
Just fixed. Please try again from dev. Thanks for reporting.
Fixed fread() error occurring for a subset of Windows users: showProgress is not type integer but type logical, #1944 and #1111. Our tests cover this usage (it is just default usage), pass on AppVeyor (Windows), win-builder (Windows) and CRAN's Windows so perhaps it only occurs on a specific and different version of Windows to all those. Thanks to #demydd for reporting. Fixed by using strictly logical type at R level and Rboolean at C level, consistently throughout.
I'm trying to read a stata file in R Studio using the following code:
library(foreign)
cdata = read.dta("http://www.ats.ucla.edu/stat/data/crime.dta")
summary(cdata)
However, the console is displaying the following error:
summary(cdata)
Error in summary(cdata) : object 'cdata' not found
Can anyone please help me out that why is this happening even though I'm just copying and pasting simple example from this link:
http://www.ats.ucla.edu/stat/r/dae/rreg.htm
Here's my sessioninfo():
sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
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] magrittr_1.5 htmltools_0.3.5 tools_3.3.1 Rcpp_0.12.7 stringi_1.1.1
[6] rmarkdown_1.0 knitr_1.14 stringr_1.1.0 digest_0.6.10 evaluate_0.9
Even if I copy paste example from blog.fosstrading.com/2011/08/tactical-asset-allocation-using.html I get this error:
error in PosLimit[, "MaxPos"] : incorrect number of dimensions
Is this a bug or am I missing something?
Output from sessionInfo():
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 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] stats graphics grDevices utils datasets methods base
other attached packages:
[1] dplyr_0.4.3 quantstrat_0.9.1687 foreach_1.4.2
[4] blotter_0.9.1695 PerformanceAnalytics_1.4.3662 FinancialInstrument_1.2.0
[7] quantmod_0.4-5 TTR_0.23-0 xts_0.9-7
[10] zoo_1.7-12
loaded via a namespace (and not attached):
[1] Rcpp_0.12.1 lattice_0.20-33 codetools_0.2-14 assertthat_0.1 grid_3.2.2
[6] R6_2.1.1 DBI_0.3.1 magrittr_1.5 iterators_1.0.7 tools_3.2.2
[11] parallel_3.2.2
You have dplyr loaded. It defines a lag function that masks the generic function, stats::lag. dplyr::lag does not do any method dispatch, so there's a lag method somewhere that isn't being called when it should be.
dplyr also masks the first and last generics defined in xts, which may also cause problems.
A short-term work-around is to call library(dplyr) first, so first and last in xts will mask their couterparts in dplyr. The long-term solution is that all packages should explicitly import all functions they use to avoid issues caused by the sequence in which packages are loaded/attached (note that user's non-packaged code will still be affected by package load/attach order).