Error function applyTheme not found even though its there!

rstudioapi

#1

Hi
I get the "Error function not found error" as below even though I used rstudio intellisense to type it. I have reinstalled and loaded rstudioapi and sos.
So the function is there but rstudio refuses to admit it:

lsf.str("package:rstudioapi")
addTheme : function (themePath, apply = FALSE, force = FALSE, globally = FALSE)
applyTheme : function (name)

but:

rstudioapi::applyTheme("Xcode")
Error: Function applyTheme not found in RStudio
findFn("applyTheme")
found 8 matches

Seems strange that it says not found in RStudio when I asked it to look in rstudioapi?

Any help please?


#2

This means that your rstudioapi is newer than your RStudio. The applyTheme function is only present in the preview version of RStudio. You can get that here:

https://www.rstudio.com/products/rstudio/download/preview/


#3

Thanks but I'm using Rstudio in a conda environment and so am limited to what Anaconda gives me which is R3.5.1 and Rstudio1.1.456.

I am puzzled that rstudioapi which is a long established package should have a function which is not available in pretty recent versions of R and Rstudio?


#4

This is because we want folks to be able to try out the new features of the RStudio Preview with the rstudioapi (without having to install rstudioapi from a non-CRAN source).


#5

I'm currently facing the same problem as rdsk, while I have installed the latest version of R and RStudio. Why is this function not available outside the preview modus?


#6

The rstudioapi doesn't do much beside invoke functionality in the IDE (i.e. it doesn't actually know how to apply a theme; it just asks the IDE to do it). The ability to apply a theme from the API is something we added in RStudio 1.2, as part of the new custom themes feature. You can read about it here:

https://blog.rstudio.com/2018/10/29/rstudio-ide-custom-theme-support/