Does anyone have a recommendation for sharing workspaces and data frames in R? I'm working at a start-up and we have little experience working in larger production environments where lots of employees are all using the same data.
Is there a way to set permissions on data frames and share them? Or do orgs in our situation just store their data in a database like MySQL and just download it to data frames on a case-by-case basis?
Any tips would be greatly appeciated from those with experience in this area!
Thanks!
Load workspace in R On the one hand, to load the RData object you can use the load function and call the file name. Once loaded, if you call the objects you saved you can access them. On the other hand, to read an RDS object you can use the readRDS function and specify the . rds file.
The workspace is your current R working environment and includes any user-defined objects (vectors, matrices, data frames, lists, functions). At the end of an R session, the user can save an image of the current workspace that is automatically reloaded the next time R is started.
To everyone learning R: Don't save your workspace. When you exit an R session, you're faced with the question of whether or not to save your workspace. You should almost never answer yes. Saving your workspace creates an image of your current variables and functions, and saves them to a file called ”.
Workspace/History (tabbed in upper right) Files/Plots/Packages/Help (tabbed in lower right)
One approach would be to dump variables via save()
to a shared location and have other read those in via load()
-- it has the added benefits of compression and fast read/write operations for binary modes.
You can of course also serialize to file or a database. Or, if you must, even to human-readable files but those will be the slowest to be read back in.
Edit As per comments, here is how to change file modes post-save:
R> foo <- 1:3
R> save(foo, file="/tmp/SimpleDemo.RData")
R> Sys.chmod("/tmp/SimpleDemo.RData", mode="0444")
R> system("ls -l /tmp/SimpleDemo.RData")
-r--r--r-- 1 edd edd 62 2011-08-15 16:26 /tmp/SimpleDemo.RData
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With