Open .R script in R studio via linux terminal - r

I am new to R and Rstudio and currently trying to figure out a few things that would easen switching too much between the linux-terminal and the file navigating system. As I prefer using the former I would therefore like a method that allows me to open .R files in R studios in-built editor but directly via the linux terminal. I have tried to illustrate what I want on the attached picture. Does this functionality exist? So far I have only been able to execute R scripts via the terminal.
I have trawled through the web trying to find a similar question but they all seem to be related to executing R scripts via the terminal rather than opening them in the Rstudio editor.

Related

Is it possible to have auto complete capability in R terminal in VSCode not just in .R file

The radian extension is great in that it allows for syntax highlighting and auto-completion inside a .R file that is loaded into VSCode. This is great when one is working on a project. However, when one is just learning something new using R (say, learning a new package by typing many lines that are useful only for the moment and no point in saving the lines), one has to take the trouble to load a .R file solely for the purpose of enjoying the convenience brought about by radian and delete the .R file after finished learning.
I think this is a condition where directly typing in the terminal is more convenient. However, while the terminal in RStudio allows for auto-completion, this is not the case in VSCode. Is there a way to enable code auto-completion in R terminal inside VSCode? Or is everyone enjoying working on .R file even when just typing lines that will not be saved?

R fails to attach to the terminal in certain workspaces in Visual Studio Code

I have been using RStudio for a while and recently switched to Visual Studio Code. Until recently, I had no issues opening any files or workspaces, but now when I open some workspaces it seems that R fails to attach to the terminal. I get no errors when I click "R: (not attached)" and ".vsc.attach()" shows up in the terminal like normal but nothing changes. Screenshot of terminal after attempting to attach R to terminal. If I open a new Visual Studio Code window and open a single file, not in a saved workspace, it opens normally and R attaches without any input from me. Screenshot of terminal after opening a new window and file not in a workspace. If I open the same file, not in a saved workspace, and then save the workspace, R is no longer attached and will no longer attach to the terminal. I tried using the fix from this post and added the code from the answer but nothing changed once again.
I started with a fresh install of Visual Studio Code from the website, not the Microsoft store, and did not sign in or sync my settings. I went through the process of setting up R again and used "C:\Program Files\R\R-4.2.1\bin\x64\R.exe" as Rpath and Rterm, which seems to be working so far. I will update my answer if the issue comes back or if I find another solution.

How to execute an R shiny script from the command line

I've created a single R file 'myfile.R' which is composed of several functions, reading from an odbc connection, and of course the ui and server components for the shiny application. The goal is for the user to treat this as an executable, that is, I'd like them to be able to run this app without having to run Rstudio. Currently on this environment, Rstudio is installed (as are the relevant packages), what I'm currently writing in command line is:
Rscript myfile.R
The file looks to be successfully loaded, but the application itself does not 'pop up' towards me, infact nothing does, it just says that it is listening on http....
I was thinking of creating a bash script that could do this, and this seemed to be the most simple approach but this is not working.

Can't get madlib.forest_train() in Rstudio by using PivotalR library

I have configured RStudio to run R code natively on Greenplum. I have searched online but I couldn't find answer to the problem I am facing at the moment.
I have imported the library(PivotalR) and library(RPostgreSQL). But, when I type madlib it just comes up with few of the functions:
The Greenplum database has also been configured with Madlib functions including madlib.forest_train, which does not show up in RStudio. I am assuming it has something to do with the PivotalR package for RStudio. Is there a way to make the forest_train work directly from RStudio?

How can I revert R Studio for Mac editor to default?

I just installed R Studio on my mac (was previously using on my virtual Windows machine). I am taking a class in which we learn to use R. The fix() function was demonstrated and when I ran it on my dataset it opened up an editor that was pretty ugly and done in X11 - that is, X11 launched automatically. The person next to me ran the same function but on her computer the pretty and I assume default R editor popped up. I have searched the internet and the options/preferences within R but cannot figure out how to both find out what the default would be if I did not have X11 installed AND change the editor in R Studio back to that program.
I can handle basic command line stuff if this is buried in a file I have to access through terminal/fancy preferences.
Has anyone run into this or have an idea of where to look? I don't want to use a text editor; just that nice-looking default program. Thanks!

Resources