I'm working with roxygen2 and for some reason I can't get it to run.
I've tried:
> devtools::load_all()
> devtools::document()
which resulted in:
Updating xxxx documentation
Loading xxxx
First time using roxygen2. Upgrading automatically...
Writing NAMESPACE
Error in file(con, "r") : cannot open the connection
In addition: Warning message: In file(con, "r") : cannot open file
'C:\Users\xxxxxxx': Permission denied
I also tried:
> roxygen2::roxygenise()
yielding:
Loading xxxx
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
cannot open file 'C:\Users\xxxxxxxx': Permission denied
I've tried installing the 6.1.0 and 6.0.1 versions of roxygen, with same results.
Any solutions? Thanks.
(Note) The following is the my Session Info:
>sessionInfo()
R version 3.5.1 (2018-07-02)
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] stringi_1.2.4 usethis_1.3.0 glue_1.3.0 git2r_0.23.0
RCurl_1.95-4.11
[6] bitops_1.0-6 rlang_0.2.1 testthat_2.0.0 roxygen2_6.1.0
devtools_1.13.6
loaded via a namespace (and not attached):
[1] Rcpp_0.12.18 digest_0.6.15 withr_2.1.2 commonmark_1.5 R6_2.2.2
[6] backports_1.1.2 magrittr_1.5 rstudioapi_0.7 xml2_1.2.0
tools_3.5.1
[11] stringr_1.3.1 yaml_2.2.0 compiler_3.5.1 memoise_1.1.0
This appears to be a minor bug in latest roxygen2 6.1.0.
See https://github.com/klutometis/roxygen/issues/766 with short term solution being offered by gustavdelius via devtools::install_github("gustavdelius/roxygen").
I imagine this will be resolved in next release of roxygen2.
Just to follow-up on this, even after using the solution above and updating to the most updated version of roxygen2 (7.0.1) I kept getting the same error. After some debugging, I found that in one of my functions I had an empty #' line in the documentation of the function. Once I omitted the empty line, I was able to run roxygenize my functions and create the documentation. Hope this helps!
I got the similar error and updating the package didn't help. Then I found I have an empty #example for one function (I plan to add the example later). I deleted the line and the problem got resolved. In my case empty #' didn't cause any problem.
Related
My quarto documents have stopped rendering suddenly. I have reinstalled RStudio and the quarto package, but this issue persists.
When I open a new quarto document, I no longer see the boilerplate material in the new document. The document is empty as if I had selected Create Empty Document, but I haven't.
Then, the document renders when all I include is raw text, but when I include an r code chunk, I get the following message.
Error in xfun::normalize_path(path, ..., must_work = must_work, resolve_symlink = FALSE) :
unused argument (resolve_symlink = FALSE)
Calls: .main ... execute -> setwd -> dirname -> <Anonymous> -> normalize_path
Execution halted
Here is the quarto document I'm attempting to render.
---
title: "Testing"
---
```{r}
mtcars |> print()
```
Here is my session info:
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22621)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.utf8
[2] LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_1.0.9 ps_1.7.2 digest_0.6.30 later_1.3.0
[5] jsonlite_1.8.4 pacman_0.5.1 evaluate_0.20 zip_2.2.2
[9] rlang_1.0.6 cli_3.4.1 rstudioapi_0.14 fs_1.5.2
[13] rmarkdown_2.20 tools_4.2.2 yaml_2.3.6 xfun_0.35
[17] fastmap_1.1.0 parallel_4.2.2 compiler_4.2.2 processx_3.8.0
[21] htmltools_0.5.4 knitr_1.41 quarto_1.2
I was having the exact same issue with knitr, this worked for me:
Remove the package "xfun" from the packages section, then reinstall it immediately after.
I'd tried changing the root install for R and everything. Turns out it was just xfun being weird.
Found the solution on the Posit Community forum.
Do you have any spaces in the filename or file path? That was preventing me from rendering for a bit.
thanks for checking out my very first post. please bear with my formatting.
Issue summary: I have been using tdplyr to access teradata database with no issue until I tested another package called dplyr.teradata for potential performance enhancement. However I can no longer connect to the database due to the following error messages:
Error: package or namespace load failed for 'tdplyr':.onLoad failed
in loadNamespace() for 'tdplyr', details:
call: parent.env(from)
error: argument is not an environment
so I deleted the dplyr.teradata package, thought that would allow my original tdplyr to work, but I still get the same error message above. then I deleted the tdplyr package without backup, trying to reinstall using the original script below:
install.packages('tdplyr',repos=c('https://teradata-download.s3.amazonaws.com','https://cloud.r-
project.org'))
but fail to install because of the same error again. Hope someone could advise on fix.
My sessioninfo is below:
sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 16299)
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] rlang_0.4.10 teradatasql_17.0.0.8 odbc_1.3.0 dplyr_1.0.2
[5] dbplyr_2.0.0 digest_0.6.27 DBI_1.1.0 hms_0.5.3
[9] bit64_4.0.5 bit_4.0.4
loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 rstudioapi_0.13 magrittr_1.5 tidyselect_1.1.0 R6_2.4.1
[6] blob_1.2.1 tools_4.0.3 xfun_0.20 tinytex_0.28 ellipsis_0.3.1
[11] assertthat_0.2.1 tibble_3.0.4 lifecycle_0.2.0 crayon_1.3.4 zip_2.1.1
[16] purrr_0.3.4 vctrs_0.3.6 glue_1.4.2 openxlsx_4.2.3 stringi_1.5.3
[21] compiler_4.0.3 pillar_1.4.6 generics_0.0.2 pkgconfig_2.0.3
found the answer myself. Pasting the answer below.
The Teradata R package is incompatible with dbplyr v2.0.0 and its later versions, which introduced some breaking changes. To use tdplyr, the version of dbplyr package must be v1.4.4. tdplyr should be installed using the following commands from your Terminal (for Linux and Mac) or Command Prompt (for Windows), till a new version that is compatible with dbplyr v2.0.0 and its later versions is released:
Install dbplyr v1.4.4 first. There are various ways to install a specific version of a R package. Teradata recommends using the following command:
Rscript -e "remotes::install_version('dbplyr',version='1.4.4',repos='https://cloud.r-project.org')"
Note: To run this above command, the R package remotes should be present on the client machine.
Next to download and install tdplyr and dependencies automatically, if minimum required versions are not met, specify the Teradata R package repository and CRAN in the repos argument for install.packages.
Rscript -e "install.packages('tdplyr',repos=c('https://teradata-download.s3.amazonaws.com','https://cloud.r-project.org'))"
I am reading in some excel data into R in a loop because I have a bunch of files. This is something that I do regularly. I am having some trouble though and I'm not sure even how to make reproducible example. So i have all the files that I want in one directory and I am reading them in using this set of commands:
## Because I want warnings to stop the loop at a certain file so I can diagnose
options(warn=2)
xl_load_in <- c()
for (x in list.files(pattern="*\\.xls")) {
cat(x, "\n ")
u <- read_excel(x,col_types=c("text","text","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","text"))
xl_load_in <- tbl_df(rbind(xl_load_in, u))
}
options(warn=0)
So this is both a tool to read in files but also, using the warn toggle, I can diagnose which files aren't reading in correctly.
Now the problem: From a fresh reboot and I can rename and save the excel files in the directory. If, however, I run the above R code, I lose the permission to save or rename the excel file where the loop broke (There are small issues with the excel files that have to rectified manually). For example if I try to rename the file upon which the loop broke I get this windows error:
The action can't be completed because the file is open in RStudio R
Session.
If I reboot, I can again modify the file in question. But before the reboot I can't save or rename the file. Can anyone explain this behaviour where R or Rstudio seems to be taking over my permissions?
Update If I close RStudio, the permissions are returned. If I do the same sequence of commands above using RGUI for Windows, the problem in replicated indicating the issue is not an RStudio problem.
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 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] stringr_1.1.0 readxl_0.1.1 lubridate_1.6.0 dplyr_0.5.0 purrr_0.2.2 readr_1.0.0 tidyr_0.6.0 tibble_1.2
[9] ggplot2_2.2.0 tidyverse_1.0.0
loaded via a namespace (and not attached):
[1] Rcpp_0.12.7 assertthat_0.1 R6_2.2.0 grid_3.3.2 plyr_1.8.4 DBI_0.5-1 gtable_0.2.0
[8] magrittr_1.5 scales_0.4.1 stringi_1.1.2 lazyeval_0.2.0 tools_3.3.2 munsell_0.4.3 colorspace_1.3-0
I just installed RSelenium from github (I have the same issue when I install it via cran) and I get the following error in windows machine:
Error in if (file.exists(file) == FALSE) if (!missing(asText) && asText == :
argument is of length zero
In addition: Warning message:
running command '"wmic" path win32_process get Caption,Processid,Commandline /format:htable' had status 44210
From the function startServer() this is the part that is producing the error:
system2("wmic", args = c("path win32_process get Caption,Processid,Commandline",
"/format:htable"), stdout = TRUE, stderr = NULL)
When I run this part I get the following:
character(0)
attr(,"status")
[1] 44210
Warning message:
running command '"wmic" path win32_process get Caption,Processid,Commandline /format:htable' had status 44210
My sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-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 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] RSelenium_1.4.2 XML_3.98-1.4 RJSONIO_1.3-0 RCurl_1.95-4.8 bitops_1.0-6
loaded via a namespace (and not attached):
[1] httr_1.2.1 R6_2.1.2 tools_3.3.1 withr_1.0.1 curl_1.0 memoise_1.0.0 knitr_1.13 git2r_0.15.0
[9] caTools_1.17.1 digest_0.6.9 devtools_1.11.1
It is an issue with Win 7.
A htable XSL stylesheet is used to format the output of WMIC path win32_process
It results as a mismatch when using regional settings. Possible workarounds given are:
Copy or move the C:\Windows\system32\wbem\en-US*.xsl files up into the C:\Windows\system32\wbem\ folder.
Change your regional settings to match your Windows language version, log out and back in.
Specify the full path: WMIC process get /format:"%WINDIR%\System32\wbem\en-US\csv"
as noted in wmic error (invalid XSL format) in windows7
I am running testthat in Rstudio (Windows 0.98.1056), and I get the following error. It seems to have appeared after I updated Rstudio and the installed R packages, but I suspect the two may not be directly related. The error occurs also on a very simple test file. Has anyone encountered this?
file: tests/test-all.R
library(testthat)
library(matrixUtils)
test_package("matrixUtils")
file: tests/testthat/matrixUtils-test.R
context("testa")
test_that("subsetting by one dimension", {
a <-1
expect_equal(a, 1)
})
Error message:
==> Sourcing R files in 'tests' directory
Error: '\.' is an unrecognized escape in character string starting "'\." Execution halted
Exited with status 1.
sessionInfo() R version 3.1.1 (2014-07-10) 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] grid stats graphics grDevices utils datasets methods base
other attached packages: [1] magrittr_1.1.0 matrixUtils_0.2 testthat_0.8.1 dplyr_0.2.0.99 reshape2_1.4 ggplot2_1.0.0 gridExtra_0.9.1 [8] zoo_1.7-11
loaded via a namespace (and not attached): [1] assertthat_0.1 colorspace_1.2-4 digest_0.6.4 gtable_0.1.2 lattice_0.20-29 MASS_7.3-34 munsell_0.4.2 [8] parallel_3.1.1 plyr_1.8.1 proto_0.3-10 Rcpp_0.11.2 scales_0.2.4 stringr_0.6.2 tools_3.1.1
>
It's hard to check your error without the package. Some ideas:
This was a similar error reported in #187 on github/hadley/testthat.
Update testthat package. Latest is 0.9.1.
Issue was closed but looks hard to reproduce. #hadley suggests a fix
check that devtools is enabled under project options in RStudio
renkun-ken added library(devtools) as a last resort in his Rprofile.
I start RStudio without .Rprofile which runs library(devtools). Test from Test package does not work, then I run devtools::test() as you suggest, and it works.
If this does not work. Check your paths and use file.path() to create paths using strings in your package. This error seems to crop up with paths misspecified.
Hope this helps gappy and you get the "woot" happy test messages soon!
M