New to R: having trouble filtering for data

Hi,

I have coding experience, but not with R and I have a question I wonder if someone could help me with please.

I trying to merge and filter a file ("temp_data") that has already been filtered (successfully) using tables created from excel worksheets. However, this second stage of filtering is not proving successful as I am finding 0 records.

temp_data <- merge(temp_data, sdate[,c("Date","Select_d","GMT")],by.x = "date_1", by.y = "Date",all.x = TRUE) %>%
filter(Select_d==1)

Both "date_1" and "Date" have the same format, i.e. 2019-04-29, where "Select_d" is equal to 1, so there should be some matches.

Apologies if I haven't given enough details here but please let me know if so and I will of course be happy to provide them.

Many thanks.

It's really hard to know without seeing data. I would suggest looking at the data BEFORE filtering.

temp_data <- merge(temp_data, sdate[,c("Date","Select_d","GMT")],by.x = "date_1", by.y = "Date",all.x = TRUE)

nrow(temp_data) 

View(temp_data) # Are there records where Select_d looks like it could be 1


1 Like

Thanks, I wanted to take a look at the temp_data file but didn’t know how- this is great as now I do! I’ll run this and see if there are some clues.

Thanks again, this was exactly what I needed in the end. I found out that the temp_data table didn't have anything for one field as the formatting was inconsistent.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.