all rows of United States got removed here.
real data:

Hi, having an issue where I want to omit rows that contain NA values, but once I use na.omit() the entire dataframe is gone. I think I am doing something wrong. I want to keep the values that exist within the Carbon_Footprint_percapita column, and delete the rows that show NA values.
my code is:
us_df <- country_data %>%
filter(country == "United States")
us_df <- us_df %>%
na.omit()
any help is appreciated. thank you!
I tried to use complete.cases() and drop_na() but one returns a list, and the other does the same as the above mentioned code. I don't know what I'm doing wrong.
You might have
NAvalues in other columns. So,tidyr::drop_nawill work fine in your case. You just need to pass column name in the code.See on this dummy data. First code works as desired while second one doesn't.
Created on 2024-03-05 with reprex v2.0.2