Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • jhan
    Junior Member
    • Aug 2012
    • 6

    Saving files in R workspace

    Hi,

    I need some help here.

    I am using R in Linux. What's the best way to save data from R process. I did 'save the workspace' when i exit R but this doesn't update the output file when I use another machine.

    What's the good way to do this?

    Jun
  • pallevillesen
    Member
    • May 2012
    • 19

    #2
    I suggest you check

    ?save
    ?load

    for saving specific R objects/data

    Comment

    • jhan
      Junior Member
      • Aug 2012
      • 6

      #3
      Thanks for the response.

      I thought the 'Save workspace image' did the same as the 'save.image'function.

      > q()
      Save workspace image? [y/n/c]: y

      aren't they the same?

      Comment

      • TiborNagy
        Senior Member
        • Mar 2010
        • 329

        #4
        When you save your workspace R creates two hidden files: .Rhistory and .RData
        Using save.image you can change this default behaviour and save to an alternative file.

        Comment

        • pallevillesen
          Member
          • May 2012
          • 19

          #5
          ...and load that file again on a different machine... (after using save.image())

          But saving specific/required objects only will make your code nicer (and memory requirements smaller).

          Comment

          • jhan
            Junior Member
            • Aug 2012
            • 6

            #6
            thanks the answering from both.

            So when I quit R the .RData saved in my working directory is a hidden file I can't see.

            Now I start saving my specific/required files using
            save(myresult, file="myresult.RData").

            This way I can see the files saved. Does that mean I can also save them as .txt or .csv to open in other environment (not R)?

            And what's the difference between save.image() and save()?

            Comment

            • TiborNagy
              Senior Member
              • Mar 2010
              • 329

              #7
              save.image() is a shortcut for save().
              You can use ascii=T options to save the images as a human readable file, but it is contains more data than you need (all objects, system settings). If you would like to save only a specific variable, use write.table() (or write.csv) instead.

              Comment

              • jhan
                Junior Member
                • Aug 2012
                • 6

                #8
                thanks for the response.

                Comment

                • Sebastiann
                  Junior Member
                  • Aug 2012
                  • 6

                  #9
                  Originally posted by TiborNagy View Post
                  save.image() is a shortcut for save().
                  You can use ascii=T options to save the images as a human readable file, but it is contains more data than you need (all objects, system settings). If you would like to save only a specific variable, use write.table() (or write.csv) instead.
                  Thnx for providing the solution i hadn't asked but was suffering with the same problem...
                  click here

                  Comment

                  • Jeremy
                    Senior Member
                    • Nov 2009
                    • 190

                    #10
                    I usually just use write(...) or write.table(...)
                    to get information about them type into R:
                    help(write)
                    and then
                    help(write.table)
                    or
                    help('whatever function you want information on')

                    Comment

                    Latest Articles

                    Collapse

                    • SEQadmin2
                      Nine Things a Sample Prep Scientist Thinks About Before Sequencing
                      by SEQadmin2


                      I’m not a sequencing expert. I’m a purification scientist who uses NGS to evaluate workflows my group develops. With this perspective, we think about the sample first and the NGS workflow second. The sequencer is an exceptionally honest reporter, but it can only report on what you give it, so whether you get clean, interpretable data from an NGS workflow is largely determined before you begin.

                      Here are nine questions we think about, in roughly the order they matter, before...
                      06-18-2026, 07:11 AM
                    • SEQadmin2
                      From Collection to Sequencing: Why Sample Preparation and Preservation Define Sequencing Data
                      by SEQadmin2


                      Data variability is still an issue in sequencing technologies despite the advances in reproducibility and accuracy of these platforms. But the problem does not originate in the sequencing itself, but in the previous steps, before the sample reaches the sequencer.


                      The first step is collection, followed by preservation and sample preparation for analysis. Most scientists overlook those steps, but not being careful might just be skewing the experiment’s results.
                      ...
                      06-02-2026, 10:05 AM

                    ad_right_rmr

                    Collapse

                    News

                    Collapse

                    Topics Statistics Last Post
                    Started by SEQadmin2, 06-26-2026, 11:10 AM
                    0 responses
                    12 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 06-17-2026, 06:09 AM
                    0 responses
                    46 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 06-09-2026, 11:58 AM
                    0 responses
                    106 views
                    0 reactions
                    Last Post SEQadmin2  
                    Started by SEQadmin2, 06-05-2026, 10:09 AM
                    0 responses
                    125 views
                    0 reactions
                    Last Post SEQadmin2  
                    Working...