Forgive me it's been a while. I'm writing a report and I want to generate sentences from this tree data "fill-in-the-blanks" style.
Here's some data for example:
species <- c("sugar maple","red oak","white ash","eastern hemlock")
size <- c(50,12,33,25)
condition <- c("fair","good","poor","good")
df <- data.frame(species, size, condition)
I'd like to get these sentences from the data:
- The sugar maple is 50 cm and is in fair condition
- The red oak is 12 cm and is in good condition
- The white ash is 33 cm and is in poor condition
- The eastern hemlock is 25 cm and is in good condition
So the data is filling in the blanks in "The ______ is __ cm and is in ____ condition"
I would like to be able to loop through different data sets and have a sentence for each tree (I think I'll be writing my first "for" loop).
If anyone could please direct me to a package or tutorial on how to do this I would be very grateful.
Thank you,
Jay