[S] Sample vs. MenuSample

Marc R. Feldesman (feldesmanm@pdx.edu)
Sun, 01 Mar 1998 20:31:08 -0800


I have a data frame with 2500 cases and 21 variables. I would like to pull
out a random sample of 1500 cases from this file. This is quite a simple
point and click action using the menus of 4.0. It doesn't seem quite as
simple in syntax. The sample() function seems to work only on vectors and
matrices, not on data frames unless I've missed something really obvious in
the online help files. I've experimented using sample with data frames but
typically I get an error along the lines of "...not enough data for samples
of this size".

Am I missing another function or does simple random sampling require
multiple functions in syntax.

FWIW, the variables in this file are a mix of numeric, categorical, and
alpha.

I can do the following:

sample.out<-sample(data.frame) but I get a completely mangled file as
sample.out. The order of the variables in the file get rearranged in a
non-obvious way and because it simply generates a file the same size as
before, doesn't accomplish what I want.

But I can't do the following:

sample.out<-sample(data.frame, 1500)

I get the error "...not enough data for samples of this size".

I'm perfectly happy sticking to the menus for this type of stuff, but I'd
like to know how to do it in syntax as well.

Thanks for your help.

Dr. Marc R. Feldesman
email: feldesmanm@pdx.edu
email: feldesman@ibm.net
pager: 503-870-2515
fax: 503-725-3905

"If ignorance is bliss then why aren't there more happy people?" Lawrence
Peter

Powered by: Monstrochoerus - the 300 MHz Pentium II
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news