[R] [External] Re: Playing a music file in R
Richard M. Heiberger
rmh @end|ng |rom temp|e@edu
Thu Jul 23 20:19:12 CEST 2020
The R command
system.file()
tells you where the currently running version of R is located on your
machine and your operating system.
On the Macintosh it shows
> system.file()
[1] "/Library/Frameworks/R.framework/Resources/library/base"
You don't need to worry about the R version number, as R knows where
it is and gives you the location
of the currently running version. You can now open a system directory
file (Finder on Mac, WindowsExplorer on Windows, etc)
and navigate up and down to what you are looking for.
Or, within R, you can navigate with .. and more directory statements,
thus the example from the original email
setWavPlayer("/Library/Frameworks/R.framework/Versions/3.6/Resources/bin/play")
# path depends on your R version etc.
would be written
tmp <- system.file("../../bin/play")
and the result is the correct location (if it is there).
You will get an empty string if it is not ther, but this will get you
started on where to look.
then you write
setWavPlayer(tmp) # path depends on your R version etc.
On Thu, Jul 23, 2020 at 7:21 AM bretschr <bretschr using xs4all.nl> wrote:
>
> Dear Vahid,
>
>
> Re:
>
> > I have a question regarding the following code:
> > setWavPlayer("/Library/Frameworks/R.framework/Versions/3.6/Resources/bin/play") # path depends on your R version etc.
> >
> > How can I find the corresponding path on my laptop?
>
>
> This line ...
>
> setWavPlayer("/Library/Frameworks/R.framework/Versions/3.6/Resources/bin/play")
>
> ... is the path on my MacBook Air running Mac OS Mojave.
> The structure of R on similar computers and OS versions will be the same, but I don't know if you use Windows or Linux.
> Maybe an R-user working with Windows or Linux can help.
> Success,
>
> Franklin
> ----
>
>
>
> Franklin Bretschneider
> Dept of Biology
> Utrecht University
> f.bretschneider using uu.nl
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list