I am trying to merge wider these 3 df. But this time, I am not getting it at all.
In the paste I had issues with merging wider, I believe due to package incompatibilities.
Here some partial attempts:
merged_df <- inner_join(dat_hr_test, dat_sbp_test )
dat_wide <- dat_sbp_test %>%
merge(dat_hr_test,
by=c("id2", "game_part" ))
merged_df <- merge(dat_hr_test, dat_sbp_test, by=c( "id2", "game_part" ), all=FALSE)
The code runs but I always end with this type of result:
Thoughts?
dfs below:
dat_hr_test <- structure(list(id2 = c(6, 7, 9, 10, 11, 14, 15, 16), game_part = c("hr_p1_session16",
"hr_p1_session16", "hr_p1_session16", "hr_p1_session16", "hr_p1_session16",
"hr_p1_session16", "hr_p1_session16", "hr_p1_session16"), hr = c(144,
126, 111, 133, 149, 109, 150, 133)), row.names = c(NA, -8L), class = c("tbl_df",
"tbl", "data.frame"))
dat_sbp_test <- structure(list(id2 = c(6, 7, 9, 10, 11, 14, 15, 16), game_part = c("sbp_p1_session16",
"sbp_p1_session16", "sbp_p1_session16", "sbp_p1_session16", "sbp_p1_session16",
"sbp_p1_session16", "sbp_p1_session16", "sbp_p1_session16"),
sbp = c(142, 141, 156, 116, 100, 161, 122, 140)), row.names = c(NA,
-8L), class = c("tbl_df", "tbl", "data.frame"))
^
dat_dbp_test <- structure(list(id2 = c(6, 7, 9, 10, 11, 14, 15, 16), game_part = c("dbp_p1_session16",
"dbp_p1_session16", "dbp_p1_session16", "dbp_p1_session16", "dbp_p1_session16",
"dbp_p1_session16", "dbp_p1_session16", "dbp_p1_session16"),
dbp = c(90, 90, 107, 96, 107, 92, 95, 85)), row.names = c(NA,
-8L), class = c("tbl_df", "tbl", "data.frame"))