[R] Reloading old R Environments/Workspaces
Jeff Newmiller
jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Thu Jul 4 02:41:19 CEST 2019
An R file is nothing more than a text file with an R extension instead of a TXT extension. Use any text editor you like to rearrange your commands in the order you want and remove false starts (beware of Notepad... it seems to have a tendency to tack on a .txt extension in addition to the .R extension of you are not careful).
If you use an R development tool like ESS or RStudio or Notepad++ with the R extension, you can type all of your commands into the file editing window first and you can use a hot key to copy them to your R console. That way you make a file and test your commands as you write them, all at once.
On July 3, 2019 5:27:37 PM PDT, Spencer Brackett <spbrackett20 using saintjosephhs.com> wrote:
>I do have a script available, though it is not in a traditional R
>script
>file/document, but an .Rhistory file as well as on Notepad. Is there a
>way
>I can convert one or both of these file types into an R script file so
>that
>I can run the commands directly to my console?
>
>Best,
>
>Spencer
>
>On Wed, Jul 3, 2019 at 8:18 PM Jeff Newmiller
><jdnewmil using dcn.davis.ca.us>
>wrote:
>
>> Saving/loading does not affect the status of packages being loaded or
>not,
>> which may affect how useful those objects are. This is why I depend
>on
>> having a script that can reproduce my results at all times, and only
>use
>> the load/save feature to minimize the number of times I have to re-do
>long
>> recalculations.
>>
>> On July 3, 2019 2:59:44 PM PDT, Spencer Brackett <
>> spbrackett20 using saintjosephhs.com> wrote:
>> >Good evening,
>> >
>> >I tried loading an R global environment that I had saved so to
>resume
>> >my
>> >work on the datasets I manipulated during that particular R session.
>> >After
>> >loading the file directly, the same items that were contained in the
>> >original working environment from the previous session appeared to
>be
>> >successfully implemented in my new environment. I used the ls()
>command
>> >to
>> >ensure that the data I had loaded through my main console was
>present
>> >and
>> >properly formatted (as it appears to be) in the environment.
>> >
>> >This is the result...
>> >
>> >> ls()
>> >[1] "anno"
>> >[2] "cnames"
>> >[3] "GBM_protein_expression"
>> >[4] "mapper"
>> >[5] "meth"
>> >[6] "protein_expression.LGG.US.(1).tsv"
>> >[7] "stringAsFactors"
>> >[8] "vec"
>> >
>> >I was expecting an object/file name of some sort to appear given
>that I
>> >had loaded two datasets in this previous R session, manipulating
>them
>> >in a
>> >manner that resulted in the above output. Does this output
>illustrate
>> >that
>> >the data I worked with in the previous R session, with its cosmetic
>> >alterations and all, are all now loaded within this session? In
>other
>> >words, has my previous work been restored? I wanted to make sure
>> >somehow as
>> >I would like to manipulate the data further.
>> >
>> >Best,
>> >
>> >Spencer
>> >
>> > [[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.
>>
>> --
>> Sent from my phone. Please excuse my brevity.
>>
--
Sent from my phone. Please excuse my brevity.
More information about the R-help
mailing list