Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

installed packages not found when setting some options in .Rprofile #2

Open
verajosemanuel opened this issue Aug 21, 2019 · 6 comments

Comments

@verajosemanuel
Copy link

verajosemanuel commented Aug 21, 2019

Double checked which .Rprofile is loading to be sure.
Using the example from documentation:

my_custom_params <- list(
  author = "Victor",
  project = list(
    folders = list(
      default = c("R", "inst", "man", "data-raw", "data", "tests"),
      selected = c("R", "man")
    ),
    packages = list(
      default = rownames(installed.packages()),
      selected = "shiny"
    )
  )
)
options("addinit" = my_custom_params)

an error is shown:

Error in installed.packages() : 
  "installed.packages" not found
@verajosemanuel verajosemanuel changed the title new folder names not present after modified .Rprofile installed packages not found when setting some options in .Rprofile Aug 21, 2019
@pvictor
Copy link
Member

pvictor commented Aug 21, 2019

Hi Jose,

Apparently you have to use the namespace of the function utils::installed.packages (although it is a function from base R).
With your previous list of directories, the display may not be optimal, tell me if you want I look into that.

Victor

@verajosemanuel
Copy link
Author

verajosemanuel commented Aug 21, 2019

thanks for your quick response.

setting the commad to utils::installed.packages crashed Rstudio with a nasty message (mac OS):

The R session had a fatal error.

ERROR r error 4 (R code execution error) [errormsg=Error: option error has NULL value
]; OCCURRED AT: rstudio::core::Error rstudio::r::exec::executeSafely(boost::function<void ()>) /Users/vagrant/workspace/IDE/macos-v1.2/src/cpp/r/RExec.cpp:224

Here my script:



my_custom_params <- list(
  author = "jm",
  project = list(
    folders = list(
      default = c("src", "data", "output", "data/raw", "data/temp", "output/plots", "output/reports", "output/data"),
      selected = c("src", "data", "output", "data/raw", "data/temp", "output/plots", "output/reports", "output/data")
    ),
    packages = list(
      default = rownames(utils::installed.packages()),
      selected = "tidyverse"
    )
  )
)
options("addinit" = my_custom_params)

@verajosemanuel
Copy link
Author

With your previous list of directories, the display may not be optimal, tell me if you want I look into that.

Yes, that would be good to be aligned in two or more lines to better layout

@pvictor
Copy link
Member

pvictor commented Aug 21, 2019

This is a weird error!

Not a real answer, but you can skip the line with default = rownames(utils::installed.packages()),, e.g. :

my_custom_params <- list(
  author = "jm",
  project = list(
    folders = list(
      default = c("src", "data", "output", "data/raw", "data/temp", "output/plots", "output/reports", "output/data"),
      selected = c("src", "data", "output", "data/raw", "data/temp", "output/plots", "output/reports", "output/data")
    ),
    packages = list(
      selected = "tidyverse"
    )
  )
)
options("addinit" = my_custom_params)

I'll think about how to better manage the display

@verajosemanuel
Copy link
Author

I'll think about how to better manage the display

Thanks a lot, I think this is a great addin to accelerate coding workflow!

@hseverac
Copy link

hseverac commented Feb 4, 2023

Apparently you have to use the namespace of the function utils::installed.packages

Mac OS here. Add same problem and this did solve it.
Thanks for your great AddInn package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants