Sample a single row, per column, within a subset of a data frame in R, while following conditions
问题 As an example of my data, I have GROUP 1 with three rows of data, and GROUP 2 with two rows of data, in a data frame: GROUP VARIABLE 1 VARIABLE 2 VARIABLE 3 1 2 6 5 1 4 NA 1 1 NA 3 8 2 1 NA 2 2 9 NA NA I would like to sample a single variable, per column from GROUP 1, to make a new row representing GROUP 1. I do not want to sample one single and complete row from GROUP 1, but rather the sampling needs to occur individually for each column. I would like to do the same for GROUP 2. Also, the