There is where I start to add more cache('.') commands, usually after any major munging step. There are some quirks, such as having to use dots instead of underlines in the object names, but that's tolerable if only slightly annoying.įrom there, I set the data loading config to FALSE, so I don't accidentally start loading data anymore, and then work on munging. Once I have the data loaded, I'll restart R, load the project, and use the caching function to have ProjectTemplate automatically cache all the files it loads. Using scripts, I can use data.table::fread or readxl easily, supply column types up front, filter out unneeded columns, and work through whatever other ugly data steps are required. I do this rather than rely on automatic data loading by file type because files are often never as clean as I need them to be. R scripts within data to write code to load the data files. I set the recursive data loading to false in the global.dcf confg file, and create. Starting clean, I throw all my data into subfolders within the data folder. I like the workflow that ProjectTemplate sets up for you. I don't use setwd or rm(list=ls(), instead prefering to make sure RStudio never saves my workspace on exit, habitually restarting R, and using ProjectTemplate for caching, loading and munging. Being able to "show your work" with intermediate files can help when sending the analysis to a non-R-using client. The point being, definitely save your intermediate steps! If the object itself is a reasonably small and simple data frame (no nested columns/strange attributes/etc), it can even make sense to save it out to a csv instead of a rds. And then, inevitably, you make an irreversible change while to an object that takes some time to generate while testing syntax, and so you try to include the steps that the produced the change in your source file, but you won't run it because that would mean wasting multiple minutes of your life. In my personal experience, not getting into the habit of saving intermediate steps to a file was the biggest impediment to completely internalizing the idea that "source is real" ((c) It makes you very dependent on your workspace, as a section of code that takes even two minutes to run seems highly wasteful to re-run when you are in the middle of an analysis. It is a good idea to break data analysis into logical, isolated pieces anyway. Now you can develop scripts to do downstream work that reload the precious object via my_precious <- readRDS(here("results", "my_precious.rds")). What about objects that take a long time to create? Isolate that bit in its own script and write the precious object to file with saveRDS(my_precious, here("results", "my_precious.rds")). Double-click the shortcut to launch Revolution R Enterprise in the future.Īll your startup settings should be applied and the default working directory should now be changed.I followed a little bit of that Twitter discussion and was somewhat surprised by the pushback the idea received (though, as you point out, the wording may have had something to do with that). Change the 'Start in:' field of the shortcutĬlick 'Apply' and 'OK' to change the shortcut settings.Ħ). Edit the properties of the Windows icon shortcut. Create a directory on your computer that contains the. Create a Windows icon shortcut on your desktop to:Ĭ:\Revolution\R-Enterprise-7.0\IDE64\RevoIDE.exeĤ). Change it if it is set to 'True'.Īlso verify that the option 'Automatically run. After opening the program, goto 'Tools -> Options -> Revolution RPE Options -> Load last solution at startup'Īnd verify that it is set to 'False'. Save this file into the directory 'C:\MyRdir'.Īlso save the file 'startup.R' with the above contents in this same folder.Ģ). As the 'File Type' select 'All Files'(*.*).ĭo not save the file with a (*.txt) file extension). First function that is called in a local. Because the Revolution IDE has its own startup and initialization sequence, you need to set any R commands you want to use in a. Automatically setting the default working directory is a bit different in Revolution R than it is in CRAN-R.
0 Comments
Leave a Reply. |