I have a large data set with 405 columns, many rows, and data from 15 sites. Each site has 27 columns, each one one quadrats data. Rows are species data.
I would like to split the data into the 15 sites and be able to use functions such as adding or averaging together all 27 columns to get an idea of the species presence at each site. I tried creating a vector of sites and using this to split the data.
"n<-rep(27,15) #repeats 27 15 times (15 sites, 27 quadrats per site in 2018) names<-c("BB", "BEP","BKP", "BP","BY",'DB','DP','H1P','LTP','NB','NP','NRP','OP','ZB','ZP') sites18<-as.factor(rep(names[rep(1:15, n)]) ) #site name replicated 27 times
When I use the split function, it loses the species data and makes one long column for each site.
I need another solution, perhaps something with an apply function, but I have been unable to find a good solution.