Gong, thanks!! but your syntax did work out as I would expect. here following are the reasons:
each row from my original data frame represents data from one subject. when the one type I number and the two type II numbers are drawn from the original data frame, both type I number and type II numbers should both from the same subject. by doing so, the new data frame should only have 3 rows with each representing one subject. I am trying to revise your syntax to make it work... :) -- View this message in context: http://r.789695.n4.nabble.com/use-sample-function-to-create-new-data-frame-tp3052110p3052629.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.