Skip to content

Commit 061ce2e

Browse files
committed
Create merge_datasets_tests.R
1 parent d68af3d commit 061ce2e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

merge_datasets_tests.R

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# merge datasets
2+
3+
path = "E:/OneDrive - University of Leeds/CREDS Data/"
4+
5+
main_api = readRDS(paste0(path,"MOT API/mot_history_main_1-21728.Rds"))
6+
main_anon = readr::read_csv(paste0(path,"MOT anoymised/test_result_2017.zip"))
7+
main_anon = main_anon[main_anon$fuel_type %in% c("DI","PE","EL","HY","OT","GB","LP","FC","ED","GD","CN","GA","LN","ST"),]
8+
9+
foo <- unique(main_anon[,c("make","model","colour","fuel_type","first_use_date")])
10+
11+
12+
13+
# try a join
14+
15+
main_api$firstUsedDate <- lubridate::ymd(main_api$firstUsedDate)
16+
main_api$primaryColour <- tolower(main_api$primaryColour)
17+
main_anon$colour <- tolower(main_anon$colour)
18+
19+
jn = dplyr::left_join(main_api[1:100,], main_anon, by = c("make" = "make","model" = "model", "firstUsedDate" = "first_use_date"))
20+
21+
22+
23+

0 commit comments

Comments
 (0)