Quantcast
Channel: Active questions tagged set-difference - Stack Overflow
Viewing all articles
Browse latest Browse all 35

Loop through list of dataframes in R to take set difference

$
0
0

I'm hoping to take the set difference between 40 dataframes (10 years of data each with 4 quarters) starting with the second quarter of my first year and comparing it to the first quarter of my first year, all the way to my last quarter. I have all my dataframes in a list, but can't figure out the loop.

short <- list(q4_17, q1_18, q2_18, q3_18, q4_18)for(i in short){j=i+1new<- j %>%filter(PATID %in% setdiff(j,i)$PATID)}

I'm getting the error: Error in FUN(left, right): nun-numeric argument to binary operator.

Thanks for any suggestions. I would try to put my dataframes up but the code is on a remote desktop and difficult to get off.


Viewing all articles
Browse latest Browse all 35

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>