[R] How to use Subpopulation data?

Peter Ehlers ehlers at ucalgary.ca
Thu Oct 1 13:43:12 CEST 2009


I assume that you are using package:sampling? (Perhaps it
wouldn't be too much trouble to include that information
with your query.)

Read ?strata and pay attention to the 'Value' section.
This will tell you that the function returns a variable

  ID_unit - the identifier of the selected units

Use this to process your samples; e.g.

  idx <- str$ID_unit
  mysample <- sampleframe[idx,]

etc.

ps
Another way to see what's in 'str' is to use the str() *function*.

  str(str)

And, as someone will surely mention, would you call your dog 'dog'?
I.e. bad choice of object name.

  -Peter Ehlers


KABELI MEFANE wrote:
> Thanks
>  
> i know, i was just simplying since i have a bigger set,
>  
> But the problem is not that.The problem is i have a sampled data and i need to use the results but when i only get the population results. How do i get the legnths,summary,etc of my sampled data not the population? 
> 
> --- On Thu, 1/10/09, Bernardo Rangel Tura <tura at centroin.com.br> wrote:
> 
> 
> From: Bernardo Rangel Tura <tura at centroin.com.br>
> Subject: Re: [R] How to use Subpopulation data?
> To: "KABELI MEFANE" <kabelimefane at yahoo.co.uk>
> Cc: R-help at r-project.org
> Date: Thursday, 1 October, 2009, 11:24 AM
> 
> 
> On Thu, 2009-10-01 at 10:06 +0000, KABELI MEFANE wrote:
>> Dear Helpers
>>
>> I have a sample frame and i have sampled from it using three methods and now i want to calculate the statistics but i only get the population parameters.
>>
>> H <- matrix(rnorm(100, mean=50000, sd=5000))
>> sampleframe=data.frame(type=c(rep("H",100)),value=c(H))
>> sampleframe
>>
>> str=strata(sampleframe,c("type"),size=c(20,), method="srswor")
> 
> Try using
> 
> str=strata(sampleframe,c("type"),size=20, method="srswor")
> 
> or better
> 
> str <- strata(sampleframe,c("type"),size=20, method="srswor")
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ______________________________________________
> 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