[R] pulling out 1 country and 1 wave

Petr PIKAL petr.pikal at precheza.cz
Wed Mar 7 08:21:20 CET 2012


Hi

> Petr,
> 
> 
> > wvs.a[,362]
> 
> 
> ### wvs.a this is data set.
> 
> ###,362 is location of  year of wave.
> 
> > table(wvs.a[,362])
> 
> > norway <- wvs.a[which(wvs.a[,362] == "2005"), ]
> 
> ###  i am renaming dataset  'norway'
> 
> ### the year of the wave in question is '2005.'
> 
> > dim(norway) 
> 
> thanks, nicole.  =))
> 
> does this help you help me, any??

Not a tiny bit.

Let me generate the data, which as I am aware only you have for the time 
being

mm<-matrix(sample(2000:2010, 3700, replace=T), 10,370)
dim(mm)
[1]  10 370
wvs.a <- as.data.frame(mm)
wvs.a[,362]
 [1] 2000 2006 2002 2007 2000 2001 2009 2003 2004 2002
table(wvs.a[,362])

2000 2001 2002 2003 2004 2006 2007 2009 
   2    1    2    1    1    1    1    1 
norway <- wvs.a[which(wvs.a[,362] == "2005"), ]
dim(norway) 
[1]   0 370

So everything works. I do not see any problem, do you?

Regards
Petr

> 
> from here i need to pull out the country 'norway' which is in the 
dataset 
> as variable 'v218'..... 
> 
> 
> 
> ----- Original Message -----
> From: "Petr PIKAL" <petr.pikal at precheza.cz>
> To: "Nicole Marie Ford" <nmford at uwm.edu>
> Cc: "r-help" <r-help at r-project.org>
> Sent: Tuesday, March 6, 2012 11:49:39 PM
> Subject: Re: [R] pulling out 1 country and 1 wave
> 
> Hi
> 
> > wvs.a[,362]
> Error: object 'wvs.a' not found
> > table(wvs.a[,362])
> Error in table(wvs.a[, 362]) : object 'wvs.a' not found
> > norway <- wvs.a[which(wvs.a[,362] == "2005"), ]
> Error: object 'wvs.a' not found
> > dim(norway) 
> Error: object 'norway' not found
> >
> 
> I get errors with all your commands and have no idea how to fix them 
> without data. There is almost no clue how your data look like so I can 
not 
> simulate them myself. As there is nothing we can try to operate on, you 
> probably does not get many answers.
> 
> Please provide at least structure of your data
> 
> str(wvs.a)
> 
> if not some part of it preferably by using 
> 
> ?dput.
> 
> Regards
> Petr
> 
> 
> > I have done the following to pull out the wave but now need to pull 
out 
> > the country form there...  but I am not sure how to do that without 
> messing it up?
> > 
> > wvs.a[,362]
> > table(wvs.a[,362])
> > norway <- wvs.a[which(wvs.a[,362] == "2005"), ]
> > dim(norway) 
> > 
> > ----- Original Message -----
> > From: "Nicole Marie Ford" <nmford at uwm.edu>
> > To: "r-help" <r-help at r-project.org>
> > Sent: Tuesday, March 6, 2012 11:08:43 PM
> > Subject: [R] pulling out 1 country and 1 wave
> > 
> > Hello.
> > 
> > I am trying to pull out one country from a time series of 5 waves. For 

> > example I need Norway from the 5th wave.  This is new to me. 
Typically, 
> I
> > work with country specific surveys.
> > 
> > 
> > data = norway
> > 
> > I have attached a .tiff of the codebook showing the variable names for 

> > Norway and the wave.  They appear to be Norway = v218 and wave = v15. 
> But
> > perhaps I am wrong and this is part of the problem. 
> > 
> > Below are examples of things I have tried.
> > 
> > For the record, no this is not at all HW, this is for my own research.
> > 
> > Thanks in advance. 
> > 
> > ~Nicole.
> > 
> > wvs.a[,v218]
> > table(wvs.a[,v218])
> > norway <- wvs.a[which(wvs.a[,v218] == "norway"), ]
> > dim(norway)
> > 
> > ______________________________________________
> > R-help at r-project.org mailing list
> > 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.
> > 
> > ______________________________________________
> > R-help at r-project.org mailing list
> > 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.



More information about the R-help mailing list