search for: indexvari

Displaying 1 result from an estimated 1 matches for "indexvari".

Did you mean: indexvar
2002 Jun 06
1
sampling from data frame
...variable that assigns a class to each case in the data frame, what is the most efficient way to sample a given number of cases from each class? I've found a roundabout solution that works as follows: for each class: assign unique index to each class member chosen_cases <- sample(n,indexvariable) extract chosen_cases from data frame (i.e. chosen <- subset(data, indexvariable %in% chosen_cases)) this solution relies on the Hmisc library and is horribly inefficient. Any ideas on how to make it better would be greatly appreciated. Best from Edinburgh, Maria -- Maria Wolter...