[R] Put one random row dataset to first cell variable

From: Jan Sabee <jan.sabee_at_gmail.com>
Date: Wed 20 Apr 2005 - 18:46:11 EST


Dear useR help,
This is below my toy dataset,

   age married income gender

 young      no    low female
   old     yes    low female
   mid      no   high female
 young     yes   high female
   mid     yes   high female
   mid      no medium female
   old      no medium female
 young     yes medium female
   mid     yes    low   male
   old     yes    low   male
 young      no   high   male
   old      no   high   male
   mid     yes   high   male
 young     yes medium   male
   old     yes medium   male

and I take one random row (young,no,low,female) then I make like this  

  age       <- c("young","mid","old")
  married   <- c("no","yes")
  income    <- c("low","high","medium")
  gender    <- c("female","male")

then I take one random row again (mid,yes,high,male), now

  age       <- c("mid","young","old")
  married   <- c("yes","no")
  income    <- c("high","low","medium")
  gender    <- c("male","female")

and etc, each I take one random row I put in the first cell in each own variable.
Is this possible to make a simple function?

Sincerely,
Jan Sabee



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Apr 20 19:05:24 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:17 EST