help to create a simulated dataset
Is this a for a homework assignment? We try to avoid doing others' homework on this list. To learn more about how to do simulations in R, search on "how to simulate data in R" or similar. This brought up many tutorials that should be helpful. If this is not homework, maybe someone else can make sense of your query and can help. I could not. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Tue, Sep 29, 2020 at 9:36 PM Peter Wagey <peter.wagley09 at gmail.com> wrote:
Hi R User,
I was trying to create a data matrix with four columns: height, locations
(three locations), temperature (three levels) and slope (three classes) and
used the following code, but it did not work. I basically wanted to have
20 rows for each class (I have a total of 9 classes). Can you help me to
fix the following code so that I can create the data frame?
daT<-data.frame(height=c(5:15))
minHeight=min(daT$height)
maxHeight=max(daT$height)
height.value= minHeight +(0:20)*(maxHeight-minHeight)/20
daT<-data.frame(height=height.value, location=rep(c("SiteA", "SiteB",
"SiteC"), 20), temperature=rep(c(10,20,30)), slope=rep(c("5deg", "10deg",
"15deg")))
Thanks
[[alternative HTML version deleted]]
______________________________________________ R-help at 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.