I have two columns, col1 and col2. Col1 can have null values, but col2 can't If col1 has null value, I want to select col2.
I tried this, where data is the dataframe example you see on the image below.
x <- data[is.na(data['col1']), c('col2')]
print(x)
I was expecting it to print the col2 (with 1440), but it prints
integer(0)
Where am I going wrong?