In my opinion the simplest way to create .Renviron file is to use usethis::edit_r_environ().
Is there any analogous command which can create .Renviron.site file ? I couldn't find that command. Or maybe you can figure out some other simply way to create .Renviron.site file ? Only ones I found were very involved and unclear.
Thanks guys
These files are plain text files. You can create them with any text editor that can create .txt files.
So, if the file doesn't already exist:
Open a plain text editor (such as RStudio or Notepad),
create a new
file (and add the desired content),
save it, e.g., as
<R_HOME>/etc/Renviron.site.
The locations where R is searching for these files are described in help("Startup").
Related
I create a text file below:
myFile<-file("toGoogle.txt")
writeLines(c("InternetShortcut]","URL=http://www.google.com","IconFile=http://www.google.com/favicon.ico",
"IconIndex=0"), myFile)
close(myFile)
For clarity the text file now contains the following:
[InternetShortcut]
URL=http://www.google.com
IconFile=http://www.google.com/favicon.ico
IconIndex=0
In Windows, if I manually rename the file to "toGoogle.url" I am prompted:
After saying "Yes" the file is now a usable web link:
However when I use file.rename or any other substitute in R to change the file extension of toGoogle.txt it creates a dead web link with a target of "".
Is there a simple way out there to create a web shortcut using R? Or how can I change the file extension in R in a way that Windows is going to recognize it?
Edit: Using R to make the url weblink gives this:
And opening it prompts me with this:
The function file.rename works for me. And why not use file("toGoogle.url") to create a .url file directly.
I know that there are already some explanations around about how to set variables in a .Renviron file. However, I couldn't find a solution to my question: How to create this file the first time. I don't want to specify the location for my installed packages, but want to insert a json file for API requests.
So can I simply create a .txt file, name it .Renviron and write the code in the file?
This should be the content of the .Renviron file:
GL_AUTH = "auth/auth.json"
GAR_CLIENT_WEB_JSON = "test.json"
I also found this line of code:
Sys.setenv(GAR_CLIENT_WEB_JSON = "app/test.json")
Do I need this line of code to fill the .Renviron file instead of typing the code directly into the file?
Thank you so much in advance!
I want to open a .jl file and convert it to a readable file preferably in .xls format.
I do not have any any idea about Julia language.
Is there a file opener for jl files?
I came here with the same question, but since the file I was looking at was clearly JSON data, I did some more searching.
The .jl file extension also refers to JSON lines, sometimes instead a .jsonl extension.
More here: http://jsonlines.org/
You can search for .json to Excel to find a converter, e.g. https://json-csv.com/ (this worked fine on my JSON lines file).
A .jl file is a julia script.
It is source code.
Not data.
You can open it up in any text editor, e.g. notepad on windows.
However, it won't normally contain anything useful to you unless you want to edit that code.
(It might contain some array literals that you want, I guess)
Perhaps you mean to ask "How can I open a .jld file"?
Which is a julia HDF5 file.
In which case please ask another question.
As I see, Julia is a script language therefor the file can be opened in a text editor like Notepad++, Vim, etc. Do not use word processor (like LibreOffice Writer) if you want to modify it, but it's OK if you want to read only.
To get started:
https://docs.julialang.org/en/stable/
I am using R Studio and I want to save my script (i.e., the upper left panel). However, the only ways that I can find to do it are by either clicking the blue floppy disk icon to save or using the drop down menu File > Save > name.R
Is there any way besides using these shortcuts to save the script to a .R file or is the shortcut the only way?
Thanks.
You can use rstudioapi::documentSave() to save the currently open script file to disk.
From the source documentation, one can see that it can be used in conjunction with the id returned with getActiveDocumentContext()$id to make sure the document saved is the one running the script.
For your intended use, try:
rstudioapi::documentSave(rstudioapi::getActiveDocumentContext()$id)
For future reference, here is the reference manual of rstudioapi:
https://cran.rstudio.com/web/packages/rstudioapi/rstudioapi.pdf
I'm not yet allowed to comment, but this refers to the comment above that this does not work with .rmd files:
rstudioapi::documentSave(rstudioapi::getActiveDocumentContext()$id)
I tried and in Rstudio Version 1.2.5042 it does seem to work.
Every new tab in R(created by ctrl+shift+n) can be independently saved by using ctrl+s in the respective tab. If you intend to rename the file though, you may do it as you would rename any file in windows(goto the file location and single click on the filename). Hope my answer was of some help!
Plain and simple: is there a way to read (not run) .sas files on osx in order to rewrite old SAS programs in another language, e.g. R? Note I do not refer to reading sas data files – I know there are several ways, I am just interested in reading old SAS code.
.sas files containing SAS code should just be a text file. You can use any text editor that you like to open and modify these files. Since the system probably doesn't have .sas files associated with any particular program you can either use the "Open with" option when "right-clicking" on the file or you could open the editor first and then open the file from within the editor.
TextEdit will work. Another editor that I like is Komodo Edit.