Snippets

Anduril CSVDplyr examples

Created by Alejandra Cervera
//Left join: keep all rows from first file and all matching from second one, having different column names
val left_join2 = CSVDplyr(csv1=myCSV1,
                          csv2=myCSV2,
                          function1="""left_join(csv2,by=c("KeyCol1"="KeyCol2"))""")

//Anti join: get the non matching rows from two files based on KeyCol, select is used for just keeping the KeyCol column from csv2
val anti = CSVDplyr(csv1=myCSV1,
                    csv2=myCSV2,
                    function1="""anti_join(select(csv2,KeyCol),by="KeyCol")""") 

//Keep only distinct ids in a csv file
val distinct = CSVDplyr(csv1=myCSV1,function1="distinct(csv1,id,.keep_all = TRUE)")

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.