how to view and edit this RData file

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

how to view and edit this RData file

Jason Levy
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


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]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: how to view and edit this RData file

Micha Silver-2

On 22/07/2020 10:35, 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


This works:


load("~/Downloads/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" ...
head(final.ord)


>
> 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]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

--
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918
https://orcid.org/0000-0002-1128-1325

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: how to view and edit this RData file

Ivan Krylov
In reply to this post by Jason Levy
On Tue, 21 Jul 2020 21:35:49 -1000
Jason Levy <[hidden email]> wrote:

> I would like help on how to view, edit and save this 2.461 MB RData
> file.

Check out the envir= argument to load() and save() if you want to
isolate the loaded data from the rest of the session.

For an example:

# create an environment to load the .rda into...
dataenv <- new.env(parent = emptyenv())
load('data.rda', envir = dataenv) # ...and load it there
ls(dataenv) # see what was inside the .rda file
dataenv$z <- volcano # edit the contents of the environment
# save the contents of the environment to an .rda file
save(list = ls(dataenv), file = 'data.rda', envir = dataenv)

--
Best regards,
Ivan

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: how to view and edit this RData file

Martin Maechler
>>>>> Ivan Krylov n Wed, 22 Jul 2020 12:42:48 +0300 writes:

   > On Tue, 21 Jul 2020 21:35:49 -1000 Jason Levy <[hidden email]> wrote:

    >> I would like help on how to view, edit and save this
    >> 2.461 MB RData file.

    > Check out the envir= argument to load() and save() if you
    > want to isolate the loaded data from the rest of the
    > session.

    > For an example:

    > # create an environment to load the .rda into...
    > dataenv <- new.env(parent = emptyenv())
    > load('data.rda', envir = dataenv) # ...and load it there
    > ls(dataenv) # see what was inside the .rda file

    > dataenv$z <- volcano # edit the contents of the environment
    > # save the contents of the environment to an .rda file
    > save(list = ls(dataenv), file = 'data.rda', envir = dataenv)

    > --
    > Best regards,
    > Ivan

Indeed.
An -- underused and not much known -- alternative is to use

  attach("data.rda")

in my view *the only*  "legitimate" use of attach() nowadays.

Martin Maechler
ETH Zurich  and   R Core team

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: how to view and edit this RData file

David Winsemius
In reply to this post by Jason Levy

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().

--

David

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: how to view and edit this RData file

Rasmus Liland-3
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

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: how to view and edit this RData file

Richard O'Keefe-2
In reply to this post by Jason Levy
> load("WVS.RData", verbose=TRUE)
Loading objects:
  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" ...

When using load() with unfamiliar data,
verbose=TRUE is your friend.
Note that this is a numeric matrix, not a data frame.

I do hope you have been told what the column names
mean because the existing names suggest only that this
may be a selection from a larger collection.

On Wed, 22 Jul 2020 at 19:40, Jason Levy <[hidden email]> 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
>
>
> 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]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.