Hi R User,
I am new in R and trying to create tables with selecting rows randomly (but
with replacement) for each group but each group should have same number as
original. Is it possible to create it using the following example data set?

Your help is highly appreciated.

dat1<-structure(list(RegionA = structure(c(1L, 1L, 2L, 3L, 3L, 4L,

5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L), .Label = c("Ra",

"Rb", "Rc", "Rd", "Re", "Rf"), class = "factor"), site = structure(c(1L,

12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 2L, 3L, 4L, 5L, 6L, 7L,

8L, 9L, 10L, 11L), .Label = c("s1", "s10", "s11", "s12", "s13",

"s14", "s15", "s16", "s17", "s18", "s19", "s2", "s3", "s4", "s5",

"s6", "s7", "s8", "s9"), class = "factor"), temp = c(23L, 21L,

10L, 15L, 16L, 8L, 13L, 1L, 23L, 19L, 25L, 19L, 12L, 16L, 19L,

21L, 12L, 5L, 7L), group = structure(c(1L, 1L, 1L, 2L, 2L, 2L,

2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), .Label = c("A",

"B", "C"), class = "factor")), .Names = c("RegionA", "site",

"temp", "group"), class = "data.frame", row.names = c(NA, -19L

))


Here group A has 3 rows,

B had 7 rows, and

C has 9 rows


I want to select rows randomly (with replacement) for each group but each
group should have same number of rows as above (group A=3 rows, B=7 rows, and
c=9 rows). This way I want to create at least 10 tables (10 random tables)
and save them separately in Excel.


Thanks

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to