0

The dataset is based on the growth of 250~ trees over 500 years. The columns are treeID, GrowthAmount. Because of the age of the data, the trees have varying amounts of measurements taken each year, and often no record for a given year.

I need to find the trees which have at least 350 measurements, then plot the mean growth for each year for only the selected trees against the year.

I have tried using select, subset, and many other things but my experience in r is very small, so I am looking for some help here

treedatalongsum = arrange(summarize(group_by(treedatalong, Tree), total = n()), desc(total))
treedatalongsum

tree%>% filter(Tree==1, 2, 3, 91,115, 116, 118, 102, 119, 121) %>% group_by(Tree)%>%summarize(mean(tree$Growth, na.rm = TRUE))

this was my original attempt and it did not work. I was trying to select the trees and have them labeled by tree ID and then show on the next column how much they grew on average

Thank you for your time and knowledge. I really appreciate it.

SSNZ
  • 11
  • 2
  • 1
    Could you provide sample from your dataframe preferably the output of `dput(head(df, 10))`? – deepseefan Aug 17 '19 at 11:47
  • `Tree == 1, 2, ...` should probably be `Tree %in% c(1, 2, ...)` – Richard Telford Aug 17 '19 at 15:25
  • [See here](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) on making an R question that folks can help with. That includes a sample of data, all necessary code, and a clear explanation of what you're trying to do and what hasn't worked. It seems like this might be more than one question: one on manipulating the data, and one on plotting it – camille Aug 17 '19 at 17:35

0 Answers0