Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #2
    I suggest you check

    ?save
    ?load

    for saving specific R objects/data

    Comment


    • #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


      • #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


        • #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


          • #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


            • #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


              • #8
                thanks for the response.

                Comment


                • #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


                  • #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

                    • seqadmin
                      Strategies for Sequencing Challenging Samples
                      by seqadmin


                      Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...
                      03-22-2024, 06:39 AM
                    • seqadmin
                      Techniques and Challenges in Conservation Genomics
                      by seqadmin



                      The field of conservation genomics centers on applying genomics technologies in support of conservation efforts and the preservation of biodiversity. This article features interviews with two researchers who showcase their innovative work and highlight the current state and future of conservation genomics.

                      Avian Conservation
                      Matthew DeSaix, a recent doctoral graduate from Kristen Ruegg’s lab at The University of Colorado, shared that most of his research...
                      03-08-2024, 10:41 AM

                    ad_right_rmr

                    Collapse

                    News

                    Collapse

                    Topics Statistics Last Post
                    Started by seqadmin, Yesterday, 06:37 PM
                    0 responses
                    8 views
                    0 likes
                    Last Post seqadmin  
                    Started by seqadmin, Yesterday, 06:07 PM
                    0 responses
                    8 views
                    0 likes
                    Last Post seqadmin  
                    Started by seqadmin, 03-22-2024, 10:03 AM
                    0 responses
                    49 views
                    0 likes
                    Last Post seqadmin  
                    Started by seqadmin, 03-21-2024, 07:32 AM
                    0 responses
                    67 views
                    0 likes
                    Last Post seqadmin  
                    Working...
                    X