0

I have been using Hilary Parker instructions to create R packages and host them at Github. They work great as long as I work locally, which defeats the purpose.

When I import my packages in other computers, other than my own, library(my_package) results in it not being found in the system. The particular system I am trying it on is a Ubuntu 16.10 machine.

install.packages("devtools")
library(devtools)
install_github("lf-araujo/sempsychiatry", force=TRUE)
devtools::install("sempsychiatry")
library("sempsychiatry")

For testing you can try one of the functions:

dependencies(c("dplyr","memisc"))

What am I missing here?

lf_araujo
  • 1,991
  • 2
  • 16
  • 39
  • check your libPaths? – Adam Quek Apr 12 '17 at 07:20
  • How do I do that? – lf_araujo Apr 12 '17 at 07:31
  • check this http://stackoverflow.com/questions/15170399/changing-r-default-library-path-using-libpaths-in-rprofile-site-fails-to-work – Adam Quek Apr 12 '17 at 07:33
  • Loading works for me. Trying out `dependencies` throws an error `Error in ifelse(i %in% installed.packages(), library(i, character.only = TRUE), : replacement has length zero`. Are you sure you're using `i %in% installed.packages()` correctly? Shouldn't it be `installed.packages() %in% i`? – Roman Luštrik Apr 12 '17 at 07:36

1 Answers1

0

As @Adam Quek noted, you can run print(.libPaths()) to see where all your libraries are stored, and check if yours is among them.

Your online github repository is sufficient to install your package. Using devtools::install_github("lf-araujo/sempsychiatry") should do the trick (I can install and use your package this way).

Please note that before you install your package on a different machine first make sure you are in a new session and you removed any trace of the old package.

Tip: 1) As long as your MWE.csv is in your main folder and not under /data is it not installed/released when loading your package. 2) If you want to have some additional information about packages this is a good read

Shaun Wilkinson
  • 473
  • 1
  • 4
  • 11
Erik Schutte
  • 300
  • 1
  • 12