I relativity new R and R Stack Overflow, so forgive me for my poor explanation
I am trying to remove all values with in the emp_length column that are Na AND the grade column with in the same row is equal to "C" OR "B"
fullData2_empData_rm <- fullData2[!is.na(fullData2$emp_length) ,]
&& (fullData2$grade != 'B' || fullData2$grade != 'C')
So far I have been unsuccessful
I have made a basic JavaScrip example, in case my explanation is not very good.
Thanks
const remove (row) => {
if(row.emp_length == null && (row.grade == 'C' || row.grade == 'B'{
removeRow()
}else{
keepRow()
}
}
We can remove the &&
and ||
to &
and |
as the &&/||
returns a single TRUE/FALSE as output
fullData2[!is.na(fullData2$emp_length) &
(fullData2$grade != 'B' |fullData2$grade != 'C'),]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.