Re: [knitr] knitr error loading rdatamarket package

785 views
Skip to first unread message

Yihui Xie

unread,
Aug 25, 2012, 9:15:30 PM8/25/12
to Ricardo Mayer, kn...@googlegroups.com
Old versions of RStudio may have problems with finding add-on
packages. The first thing that you can do is to make sure you are
using the latest version of RStudio. If the latest version does not
work, check

find.package(c('ggplot2', 'rdatamarket'))

In your case, I bet rdatamarket was installed in a different library
location. Reinstall this package may help. If the problem still
exists, you need to report to
http://support.rstudio.org/help/discussions/problems

Regards,
Yihui
--
Yihui Xie <xiey...@gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Sat, Aug 25, 2012 at 6:48 PM, Ricardo Mayer <ricard...@gmail.com> wrote:
> Dear all,
>
> I'm a knitr noob and I have come across a strange error.
>
> I'm using an R package called rdatamarket.
>
> If a write a chunk to load this package with library(rdatamarket), the
> following happens:
>
> + If, in RStudio, I "Evaluate the current chunk" , then all goes well
> and the package is found and load
>
> + BUT if I press Knit HTML, then the same chunk fails and I get an
> error message: "## Error: there is no package called 'rdatamarket'"
>
> However, nothing goes wrong loading some other package, such as "ggplot2"
> or "tables"
>
> is this a knitr problem, RStudio problem or rdatamarket problem?
>
> Thanks in advance!!!
>
> PS. I've attached a simple Rmd file where to appreciate this problem

Ricardo Mayer

unread,
Aug 25, 2012, 9:34:54 PM8/25/12
to kn...@googlegroups.com, Ricardo Mayer
Thank Yihui for you prompt response!

   you were right ... rdatamarket existed in RStudio/R/library  ...

   I just deleted that directory after installing rdatamarket in my default lib location

  Now, when I KnitHTML the file, the package gets loaded but, I get a different error message.

   ## Error: package/namespace load failed for 'rdatamarket' 

but, again, Run All Chunks does it flawlessly

should I pester the folks at RStudio, instead? I guess, I do.

Yihui Xie

unread,
Aug 25, 2012, 10:18:30 PM8/25/12
to Ricardo Mayer, kn...@googlegroups.com
This error message often indicates problems in the package
dependencies. My guess is the dependencies of rdatamarket are still in
the RStudio library. You probably want to remove everything under
RStudio/R/library/..., and always install packages in your own lib
loc.

Regards,
Yihui
--
Yihui Xie <xiey...@gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


Ricardo Mayer

unread,
Aug 25, 2012, 10:19:50 PM8/25/12
to kn...@googlegroups.com, Ricardo Mayer
addendum: I'm using the newest stable RStudio 0.96.330 

Yihui Xie

unread,
Aug 25, 2012, 10:22:46 PM8/25/12
to Ricardo Mayer, kn...@googlegroups.com
You can probably report this to them: packages are installed to
RStudio/R/library/ but cannot be found when in an R session which is
not started by RStudio. I do not quite understand why it is necessary
to introduce this special library location which is not portable.

Regards,
Yihui
--
Yihui Xie <xiey...@gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


Ricardo Mayer

unread,
Aug 25, 2012, 10:24:30 PM8/25/12
to kn...@googlegroups.com, Ricardo Mayer
Damn you are good! :-)

That was exactly what was happening!!

I removed RCurl and the other dependency (well, everything except RStudio's manipulate) and now the Rmd file compiles OK

thank you!


PS. yup, I'll make that report

Yihui Xie

unread,
Aug 25, 2012, 10:36:36 PM8/25/12
to Ricardo Mayer, kn...@googlegroups.com
Oh, you mentioned manipulate. I forgot that one. Then it makes some
sense to have a special RStudio lib loc (to put their own packages
which are not on CRAN), but in general RStudio should put lower
priority on its own lib loc and use the user's lib loc first. I'm not
sure what is their current status now; perhaps this is just a legacy
problem which does not happen to freshly installed new versions of
RStudio. For example, I have a ~/.Renviron which specifies
R_LIBS_USER="~/R" and RStudio just R packages into this directory.

Regards,
Yihui
--
Yihui Xie <xiey...@gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


Reply all
Reply to author
Forward
0 new messages