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
                      Essential Discoveries and Tools in Epitranscriptomics
                      by seqadmin




                      The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist...
                      04-22-2024, 07:01 AM
                    • seqadmin
                      Current Approaches to Protein Sequencing
                      by seqadmin


                      Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
                      04-04-2024, 04:25 PM

                    ad_right_rmr

                    Collapse

                    News

                    Collapse

                    Topics Statistics Last Post
                    Started by seqadmin, 04-11-2024, 12:08 PM
                    0 responses
                    59 views
                    0 likes
                    Last Post seqadmin  
                    Started by seqadmin, 04-10-2024, 10:19 PM
                    0 responses
                    57 views
                    0 likes
                    Last Post seqadmin  
                    Started by seqadmin, 04-10-2024, 09:21 AM
                    0 responses
                    51 views
                    0 likes
                    Last Post seqadmin  
                    Started by seqadmin, 04-04-2024, 09:00 AM
                    0 responses
                    55 views
                    0 likes
                    Last Post seqadmin  
                    Working...
                    X