How to get the missing entries between two CSV files in R? -


i have csv1 file

identity, adname,location,state 345,demo,san francisco,ca 587,cusco,freemont,ca 899,rest,werchesye,ca 

and csv2 file

identity,adname,location,state,locationcode 345,demo,san francisco,ca,90 587,cusco,freemont,ca,89 

i want desired output

identity, adname,location,state 899,rest,werchesye,ca 

basically want missing information in csv file 2 of 1? how in r? new r.

assuming 2 files can joined identity column, here you:

f1 <- read.csv('file1.csv') f2 <- read.csv('file2.csv') diff <- subset(f1, !identity %in% f2$identity) write.csv(diff, file='diff.csv', quote=f, row.names=f) 

the subset takes rows f1 (your first dataset) identify field not exist in f2$identity (your second dataset).

when writing result csv, set non-default values quote=f, row.names=f match format asked for.


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -