helpers 
 
 
I have tried doing everything i can but i think my problem may be solved by 
even one command or statement. If i have a dataframe with variale name A,B,C 
and i subset this dataframe, how do i retain the variable names to use in my 
subset. 
 
In short i need to forget about the original dataframe until after i have 
finished with the subset, then also how do i call it back, may be by 
sampleframe$type,.......sampleframe$value?
 
Thanks and i rest my case

--- On Thu, 1/10/09, KABELI MEFANE <kabelimef...@yahoo.co.uk> wrote:


From: KABELI MEFANE <kabelimef...@yahoo.co.uk>
Subject: Re: [R] How to use Subpopulation data?
To: "Peter Ehlers" <ehl...@ucalgary.ca>
Cc: R-help@r-project.org, "Bernardo Rangel Tura" <t...@centroin.com.br>
Date: Thursday, 1 October, 2009, 2:34 PM



Thanks 
 
i was not aware of str, i have a very large code since i am new to r.
I forgot to mention that the package is sampling. Actually i have this 
simulated code:
 
n <- c(100,400,1000,1500,2000)
x <- c(2,3,3,3,5)
y <- c(7,7,9,10,10)
s <- function(mn, mx, n) {sample(mn:mx, n, replace=TRUE)}
rating=unlist(mapply(s, x, y, n))

Hypermarket <- matrix(rnorm(100, mean=50000, sd=5000))
Supermarket <- matrix(rnorm(400, mean=34000, sd=3000))
Minimarket  <- matrix(rnorm(1000, mean=10000,sd=2000))
Cornershop  <- matrix(rnorm(1500, mean=2500, sd=500))
Spazashop   <- matrix(rnorm(2000, mean=1000, sd=250))
dat=data.frame(type=c(rep("Hypermarket",100), rep("Supermarket",400),
rep("Minimarket",1000),rep("Cornershop",1500), rep("Spazashop",2000)),
value=c(Hypermarket, Supermarket, Minimarket, Cornershop,Spazashop))
 
##sample frame
sampleframe=data.frame(type=c(rep("Hypermarket",100), rep("Supermarket",400),
rep("Minimarket",1000),rep("Cornershop",1500), rep("Spazashop",2000)),
value=c(Hypermarket, Supermarket, Minimarket, Cornershop,Spazashop),
ratings =cbind(rating))
 
## package sampling
 
stra=strata(sampleframe,c("type","value","rating"),size=c(20,80,200,300,400),
method="srswor")
sample.strat<-getdata(sampleframe,stra)

sample.strat

now i want to find different estimates from sample.strat
 
Help appreciated.





      
    [[alternative HTML version deleted]]


-----Inline Attachment Follows-----


______________________________________________
R-help@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.



      
        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to