[R] Can't open R files

Boris Steipe bor|@@@te|pe @end|ng |rom utoronto@c@
Mon May 21 18:18:50 CEST 2018


Just for completeness: there are several ways to open files for editing in RStudio -

 * Configure your computer to be able to double-click on a file and open it
   in RStudio: this is OS dependent. Google for "change file associations"
   to get advice.

 * Drag and drop a file icon onto the RStudio icon.

 * When RStudio is running, 
   -  use the File -> open dialogue like Duncan said;
   -  if you have worked with the file recently, use the File -> Recent files ...
      dialogue;
   -  if the file is in your "working directory", it appears in the
      "file pane" of the RStudio window (bottom right). Click on the name.
      If it's not in the working directory, navigate the file pane by 
      clicking on the ".." to go to a parent folder, or on a folder name
      to descend into the folder;

  *  On the command line, execute file.edit("<filename>"). You can also put
     this command into a script that you source(). (But not in the .RProfile
     script.)

  *  Programmatically, you can readLines() a file, add and change contents
     and writeLines() the result.

Cheers,
B.




> On 2018-05-21, at 07:31, Nick Wray via R-help <r-help using r-project.org> wrote:
> 
> Oh fab it works! thanks v much i'd never used open file like that before Nick
> 
>> On 21 May 2018 at 12:24 Duncan Murdoch <murdoch.duncan using gmail.com> wrote:
>> 
>> 
>> On 21/05/2018 7:20 AM, Nick Wray via R-help wrote:
>>> Hello. I'm not sure whether this is strictly the right forum but here goes... I have got a new (well reconditioned) laptop and have installed R studio on it. That works fine if I say write a little prog directly into it or paste R script from a word doc. But if I try to open an R prog (which I've written elsewhere, the laptop doesn't recognise it as an R prog. Instead it gives me a little icon with a pair of binoculars and says to try to find an app for opening said file.
>>> 
>>> But up to now I can't find anything on the net which will open the R files in the same way as they simply do on my desktop or old laptop.
>>> 
>>> I'd be grateful for any ideas or pointers
>> 
>> If you open RStudio, and use the File | Open File... menu, will it open
>> the program?
>> 
>> If so, then the problem is with your file associations. If you're using
>> Windows, you need to right click on the file, choose "Open with...",
>> then pick RStudio and check the box saying you want to open all files
>> that way.
>> 
>> Duncan Murdoch
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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