[R] how to view and edit this RData file

Rasmus Liland jr@| @end|ng |rom po@teo@no
Thu Jul 23 02:54:29 CEST 2020


On 2020-07-22 16:38 -0700, David Winsemius wrote:
> On 7/22/20 12:35 AM, Jason Levy wrote:
> > Dear R Scholars
> > 
> > Many R users have successfully loaded and used the attached WVS RDATA file
> > into my R program. I would just would like help viewing, editing etc.
> > 
> > I wanted to include the actual RData file (which was not attached
> > previously)
> > 
> > I can successfully load the RData file:
> > load('WVS.RData')
> > 
> > https://drive.google.com/drive/u/1/folders/15QhSBkwEfHLqgZznoaqodWglXuxV4f7P
> 
> In a clean session I executed this:
> 
> load("/home/david/Downloads/WVS RData file/WVS.RData")
> ls()
> #[1] "final.ord"
> 
>  str(final.ord)
> # num [1:82992, 1:74] 2 2 1 2 2 1 2 1 2 2 ...
> #- attr(*, "dimnames")=List of 2
> #..$ : NULL
> 
> # ..$ : chr [1:74] "v12" "v13" "v14" "v15" ...
> 
> So it appears to be a matrix with 74 
> columns and 82,992 rows.
> 
> > I would like help on how to view, edit and save this 2.461 MB RData file.
> > I am at my wits end. I apologize for asking such a basic question. I
> > appreciate your help in advance
> > 
> > 	[[alternative HTML version deleted]]
> 
> You have repeatedly posted in HTML. 
> Gmail makes it easy to post in palin 
> text if you are using their client. 
> Please read the Posting Guide and I 
> would suggest also reading and working 
> through the examples in a good 
> introductory tutorial on Rhelp. The 
> "Introduction to R" that ships with 
> all copies of R should have 
> illustrated using both ls() and 
> str().

On 2020-07-22 20:47 +1000, Jim Lemon wrote:
> Hi Jason,
> I assume that you actually have 
> "WVS.RData" in your working directory 
> when you try to load it. Otherwise you 
> will get an error message. If you 
> don't get an error message when you do 
> this:

Dear Jason,

Just re-iterating Jim and David's 
answers:

> objects()
character(0)
> load("WVS.RData")
> objects()
[1] "final.ord"
> str(final.ord)
 num [1:82992, 1:74] 2 2 1 2 2 1 2 1 2 2 ...
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr [1:74] "v12" "v13" "v14" "v15" ...
> typeof(final.ord)
[1] "double"
> dim(final.ord)
[1] 82992    74
> options(width=40)
> table(final.ord)
final.ord
      1       2       3       4       5
2159651 1649054  727911  385054  232812
      6       7       8       9      10
 118567   99269   92795   60633  111955
     11
  36141
> final.ord.1 <- edit(final.ord)
> table(final.ord.1)
final.ord.1
      1       2       3       4       5
2159649 1649053  727911  385054  232812
      6       7       8       9      10
 118567   99269   92795   60633  111955
     11      42   1e+05
  36141       2       1
> save(final.ord.1, file="WVS.1.RData")

Best,
Rasmus

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20200723/0168bfa2/attachment.sig>


More information about the R-help mailing list