Home > Software design >  Performance indices for unequal datasets in R
Performance indices for unequal datasets in R

Time:05-15

I wanted to do the performance indices in R. My data looks like this (example): enter image description here

I want to ignore the comparison of values in Time 2 and 4 in data frame 1 and then compare it with the available set of observed data. I know how to develop the equation for the performance indicators (R2, RMSE, IA, etc.), but I am not sure how to ignore the data in the simulated data frame when corresponding observed data is not available for comparison.

CodePudding user response:

Perhaps just do a left join, and compare the columns directly?

library(dplyr)
left_join(d2,d1 %>% rename(simData=Data), by="Time")

Output:

   Time  Data simData
  <dbl> <dbl>   <dbl>
1     1    57      52
2     3    88      78
3     5    19      23

Input:

d1 = structure(list(Time = c(1, 2, 3, 4, 5), Data = c(52, 56, 78, 
56, 23)), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA, 
-5L))

d2 = structure(list(Time = c(1, 3, 5), Data = c(57, 88, 19)), class = c("tbl_df", 
"tbl", "data.frame"), row.names = c(NA, -3L))
  •  Tags:  
  • r
  • Related