I am new to R and am busy with an assignment that asks me to extract 10 samples of a 1000 random (but uniformly distributed) entries from a given dataset. I have found the sample.int function and it works to create a single dataframe result but I would like to create a list of the 10 random dataframes that I could use later to conduct a multiple linear regression model.
Also not sure if the sample.int gives me a runif selection of numbers
Help will be appreciated...as the below is all I have and cannot get off the ground
random.sample <- df[sample.int(nrow(df),1000),]
I was thinking, if I can create a loop to randomly select 1000 entries and create 10 dataframes, then I could use the list function and add them to it?
Aucun commentaire:
Enregistrer un commentaire