Vincent Laufer
Vincent Laufer

Reputation: 705

opening gzipped file that is saved as .R

I am opening a large (347M) .R file. In Rstudio with R3.1.2

After mucking around with various input functions, I eventually got R to return this:

file("/Users/vincentlaufer/Desktop/all.t.subsets.R")
                                   description                                          class                                           mode 
"/Users/vincentlaufer/Desktop/all.t.subsets.R"                                       "gzfile"                                           "rt" 
                                          text                                         opened                                       can read 
                                        "text"                                       "closed"                                          "yes" 
                                     can write 
                                         "yes" 

So, I tried working on opening it in the following way:

splat <- scan(gzfile("/Users/vincentlaufer/Desktop/all.t.subsets.R"), what="Factor")

(I chose Factor because Rstudio told me that "RDX2" is a Factor. I don't know what RDX2 is because I cannot open the file, probably a gene name..)

displaying the variable I created, splat, returns the following

> splat
 [1] "RDX2"                                                                                                
 [2] "X"                                                                                                   
 [3] ""                                                                                                    
 [4] "\002"                                                                                                
 [5] ""                                                                                                    
 [6] "\025beta.combat.x.th1th17"                                                                           
 [7] "\033q?\xd9\xce\a_o\xd2"                                                                              
 [8] "?\xe0\x85\x87\x93\u0757\xf6?\xe1&\027\xc1\xbd\xa5\022?\xec\037!-w1\x90?\xed|\xed\x91hr\xb0?\xe0-\xe0"
 [9] "\033qv?\xc9\xf2\022\xd7s\030\xfc?\xe8\xa3\xd7"                                                       
[10] "=p\xa4?\xe1\xdc\xc6?\024\022\006?\xee>BZ\xeec"                                                       
[11] "?\xee\027\xc1\xbd\xa5\021\x9d?\xe0\xb0\xf2{\xb2\xfe\xc8?\xe7" 

I am a bit out of depth here. Can anyone tell me how to open this .R file.

Upvotes: 0

Views: 538

Answers (1)

Ben
Ben

Reputation: 11471

The file is a binary files saved by R. (You can tell because of the RDX2 entry which says what kind of file it is - see http://biostat.mc.vanderbilt.edu/wiki/Main/RBinaryFormat)

You should try loading it using load("/Users/vincentlaufer/Desktop/all.t.subsets.R")

Upvotes: 1

Related Questions