I have merged two data frames using bind_rows. I have a situation where I have two rows of data as for example below:
Page Path Page Title Byline Pageviews
/facilities/when-lighting-strikes NA NA 668
/facilities/when-lighting-strikes When Lighting Strikes Tom Jones NA
When I have these type of duplicate page paths I'd like to merge the identical page paths, eliminate the two NA's in the first row keeping the page title (When Lighting Strikes) and Byline (Tom Jones) and then keep the pageviews result of 668 from the first row. Somehow it seems that I need
- to identify the duplicate pages paths
- look to see if there are different titles and bylines; remove NAs
- keep the row with the pageview result; remove the NA row
Is there a way I can do this in R dplyr? Or is there a better way?