check empty data

I am checking if my column (name) have any empty cell but getting error. any solution....???

df <- df %>% mutate(is_blank_node = which(df$Name == "", arr.ind = TRUE),1 )

Error:

Error: Problem with mutate() input is_blank_node.
x Input is_blank_name can't be recycled to size 182753.
i Input is_blank_name is which(df$Name == "", arr.ind = TRUE).
i Input is_blank_name must be size 182753 or 1, not 0.

Hello!

It is not completely clear how your code should work but you can do something like the below:

sapply(iris, is.na)

This will return a dataframe that shows you for all values if there is empty cells or not. You can then reduce those columns to single values. Is this helpful?

1 Like

Let me know if this is the solution you needed :slight_smile:

I think your issue here is missing two different syntax (base / tidyverse)
I'm guessing the tidyverse style you would use would be

df <- df %>% mutate(is_blank_node = Name == "")

although the above assumes the character field Name would be character(0) rather than na_character_ when 'blank'

actually i am trying mutate a new column in my data frame to 1 if particular is empty
for example

nama empty
ttt 0
mna 0
vga 0
hja 0
1
nhu 0

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.