简体   繁体   中英

Performance indices for unequal datasets in R

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.

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))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM