Very interesting.... I will have to take a look. Thank you very much for the reference to these resources! They will be of great help to me. Many thanks, Spencer On Wed, Jul 3, 2019 at 8:41 PM Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:> 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 at 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 at 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 at 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 at 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. >[[alternative HTML version deleted]]
Hello again, I might be repeating myself here, so my apologies, but do I have to run a script file from my R Studio to reimplement my previous work for a given project.... so to start up where I left off.... or is opening up R and, with my global environment automatically reloading as it was when I last worked on, sufficient? Best, Spencer On Wed, Jul 3, 2019 at 8:44 PM Spencer Brackett < spbrackett20 at saintjosephhs.com> wrote:> Very interesting.... I will have to take a look. Thank you very much for > the reference to these resources! They will be of great help to me. > > Many thanks, > > Spencer > > On Wed, Jul 3, 2019 at 8:41 PM Jeff Newmiller <jdnewmil at dcn.davis.ca.us> > wrote: > >> 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 at 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 at 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 at 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 at 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. >> >[[alternative HTML version deleted]]
On 04/07/2019 12:32 p.m., Spencer Brackett wrote:> Hello again, > > I might be repeating myself here, so my apologies, but do I have to run a > script file from my R Studio to reimplement my previous work for a given > project.... so to start up where I left off.... or is opening up R and, > with my global environment automatically reloading as it was when I last > worked on, sufficient?Saving your workspace when you quit is a common default, but it is generally a bad idea. Old junk collects in there, and makes new results harder to debug. A better workflow is to never save the whole workspace. If you have just computed some object(s) and the computation took so long you don't want to repeat it, then save just a minimum, and load them later in a new session. A particularly dangerous situation happens if you sometimes save your workspace and sometimes don't. You can end up with situations like this: Session 1: compute some random values. Save the workspace, including the random number key. Session 2: automatically load the saved workspace. Compute some new random values. Quit without saving the workspace. Session 3: automatically load the saved workspace from Session 1, including the random number seed. Any random values computed in this session could be identical to the values in Session 2, because they are starting with the same seed. If you don't have a saved workspace to load, you end up with a blank slate, and the random number key is generated based on time of day and process number, so is almost certainly different in every session. (Sometimes you want a repeated seed for reproducibility, but it's always bad when you're surprised by one.) Duncan Murdoch