I am new to data science and code sharing.
I am trying to share my R codes with my team. I have created a jupyter notebook, created a github repository, then upload my notebook to Binders.
My script in Binders is interactive, however, it runs as python code and not R code.
there are a few steps that I was not too sure that might mess this up.
1- for the requremnt.txt file, I had to manually type the package name with their version. I would love it if someone tells me what is the right way to create requirement file for R script
2-In the repository creation on github I didn't know what I had to pick for "Add.fitignore" or "Add a license" so I left them to "None"
when I open my notebook in Binders, it gives me an error Kernel not found.
What am I doing wrong? Please help
I have installed R on jupyternote book, and it works fine when I open the notebook using Anaconda.
Related
I am trying to open a Jupyter Notebook file in classic Jupyter Notebook interface. I am attempting to create an interective app that uses Julia programming language in interactive codes. For that I am trying to use the Interact library, because I know it features things such as buttons, sliders, etc. It requires the WebIo extension to be installed. However, from what I have experienced so far, Jupyter notebook does not detect the WebIO extension.
I tried following the instructions at https://juliagizmos.github.io/WebIO.jl/stable/gettingstarted/ and at https://juliagizmos.github.io/WebIO.jl/stable/troubleshooting/not-detected/. In the last link I found that another extension needed to be install and I found more information in this link (https://juliagizmos.github.io/WebIO.jl/latest/providers/ijulia/). I tried executing this command in my Windows prompt and it had apperently been succesful. When executing the command suggested at the second link, I got an error in the Julia REPL saying that WebIO extension for Jupyter Lab must be installed through Python or Conda, which I had already done.
I am also a bit confused as to how I can check to see if the extension is enabled.
I believe the problem has to do either with the installation of IJulia or the pip installation of WebIO. I rarely use pip, so I don't know if I did it correctly.
Thank you.
This question may seem pretty naive and I bag your patience.
I have saved extension.RData and documented it in extension.R. Both of them are saved in /data folder of the R package I am developing.
As I close RStuidio and reload the package, however, I cannot call the data until I execute one of the functions, devtools::document() or devtool::load_all(). Does this suggest that my dataset is not in memory of the package? How could I not to execute devtools every time I start working on the package?
Thank you very much.
As I have understood, you just created files extension.RData, extension.R (with documentation) in your project directory. However, this is not enough for RStudio to be able to reach your data. You have to install the package by running devtools::install() or clicking 'Build & Reload' button on 'Build' tab of RStudio.
Edit: Putting extension.R into R folder solves the problem.
I'm trying to use the SemiMarkov package and I want to change one small line of code in there. I've done some digging via:
getAnywhere("semiMarkov")
& I've identified that I want to change this line:
hessian <- diag(ginv(hessian(V, solution)))
to try something like:
hessian <- diag(ginv(pracma::hessian(V, solution)))
How do I go about this? Do I need to rebuild the package from scratch, and if so do I need rTools etc for this, or is there a simple-ish workaround (I'm a relevant R novice)? I've done some searching online and can't find anything obvious. Any ideas/pointers gratefully appreciated.
If you'd like to simply test out the effect of that change in an interactive R session, you can do so using trace(). Here's how:
Type trace("semiMarkov", edit=TRUE)
In the text editor that that launches, edit the line of interest.
Save the modified file.
Close the text editor
Back in R, use the modified function.
Linux environment
Starting with downloading the package source from CRAN.
This is the landing page: https://cran.r-project.org/web/packages/SemiMarkov/index.html
This is the package source: https://cran.r-project.org/src/contrib/SemiMarkov_1.4.2.tar.gz
Download and extract the source:
wget https://cran.r-project.org/src/contrib/SemiMarkov_1.4.2.tar.gz
tar -xvzf SemiMarkov_1.4.2.tar.gz
This should result in a directory named SemiMarkov. Open up the source (cd SemiMarkov), and modify as necessary.
Next, build the changes:
cd ..
R CMD build SemiMarkov/
This will result in a new archive file named SemiMarkov_1.4.2.tar.gz.
Lastly, install your modified archive:
R CMD INSTALL SemiMarkov_1.4.2.tar.gz
Windows environment
I'm less familiar with the Windows platform. *nix tooling is available in Cygwin, but it's painful. Instead, as Josh O'Brien points out, you should follow the Windows-specific instructions in the R Installation and Administration manual.
I am quite new with Sublime Text 2. I would like to write my script in ST2 and run/send it to the R console. I don't want to use SublimeREPL (most of the forums deal with this) because I want to have my R console open on the side.
I tried to install "R Tools" and the installation of this package seems to work. However, when I open my script.r file and try to run it, nothing happens. I also tried to specify the path to go to R in TOols>Build systems> new build systems... withou being successful.
Can someone give me a trick to solve this?
Thanks a lot!
The easiest way is to install the Enhanced-R package via the Package Manager in Sublime:
Install the Package Control here
Access the Package Manager within Sublime (on Windows: Ctrl+Shift+P)
Type Install Package and then Enhanced-R
Send the highlighted code to R console (on Windows: Ctr+Enter)
You can see the Enhanced-R package description and relevant key bindings here
I just stumbled upon this post because I had a similar problem using Sublime and R. Maybe this helps someone who wants to have a similar setup. Hopefully there will be more and more R users considering Sublime. I figured out the following solution using the Sublime build system in an external xterm terminal (for Linux, but it should be very similar to a setup on Win/Mac systems):
Sublime Text 3 build system: keep console running
i am creating a package in R language, everything is running properly, but when i run R CMD check , it shows an error message while running examples.. i.e.
"can't open the file." "No such file or directory"
actually my function needs a PubMed text file containing abstracts from the PubMed, i have placed my text file in every sub-directory of my package, but its not working. showing same error again and again.
so please suggest me the right way how to put a text file in a package which can be used by examples to run properly.
i will be very thankful to you.
Usually you put such data in the /inst folder. E.g.:
<packageRoot>/inst/pubmed/myfile
After the package is build you can access the content of this folder from within the package like this:
system.file( "pubmed/myfile", package="<package>" )
See for more information http://cran.r-project.org/doc/manuals/r-release/R-exts.pdf (1.1.5 Data in packages).
I suggest you to use devtools and roxygen2 packages. Basically, you just need to prepare description and .R files.
see more details in this brilliant answer :devtools roxygen package creation and rd documentation