search for: indexvariable

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

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 Wolters m...