I'm completely new to R, and I have a question that I think should not be very hard but is so for me.. I hope you can help me!
So I have a data frame with multiple data points from the same year (observations) and I have a data frama with only one data point from each year (modelled). Now I want to match the modelled data to right observational data.
Observed and modelled values can be seen in the link beneath the question!
This is the code I used to " pick out " the right values from the modelling:
Result <- matrix(nrow=length(Koutiala[,1]), ncol=1)
teller <- 1
if (Koutiala[1,1]==5) {
Result[1,1] <- (Store[[2]]$soil$C$totalSoilC[5]/3000000)*100
teller <- teller + 1
}
for(i in seq(1, length(Koutiala[,1]) , 1)) {
if (i %in% unique(Koutiala[,1])) {
Result[i] <- ((Store[[2]]$soil$C$totalSoilC[i]/3000000)*100)
teller <- teller + 1}
else {
Result[i] <- NA}
}
Now I want to match for example Result[5] with Koutiala[1]; Result[6] with Koutiala[3]; Result[8] with Koutiala[4] etc...
Can anybody help me with this? I don't want do it manual because the dataset is actually very big!
Thank you so much, Renske