lundi 10 juin 2019

if statement with length function

Resetting the length of an object using if statement

I am doing web scraping. There is an if statement as follows

{if(length(title) == 0) NA else title} Originally length of title is 12.

Now here i am confused over length function.

length(title) gives me 12. length(title)==0 gives me FALSE. So, putting length(title)==0 makes no sense because we already know that length of title is 12, then what's the point of putting it to 0.

Aucun commentaire:

Enregistrer un commentaire