Relatively new user to R and still trying to get my bearings on how R handles dataframes.
Specifically, I am trying to filter a data frame based on a column value.
The Python pandas equivalent would be:
df_temp = df.loc[df['col1']==1,'col1']
From my experience, this returns a Series where all values equal 1.
I'm trying to do something similar in R where I have a dataframe, I'm using the code below, however, I keep getting the full-length column returned with values of 1 and "NA"
temp <- RAVE_ITN_BVAS_ADVIS3[RAVE_ITN_BVAS_ADVIS3$`Sensorineural deafness`==1, 'Sensorineural deafness']
So my question is two-fold:
Is there a better way to filter data frames in R?
Does R simply turn all values that do not equal 1 into NA and then return the full-length column? If so, this would be frustrating as then it brings up issues with deal with NAs all the time.
Any input appreciates and let me know how I can further clarify.
Thank you all!