@RonakShah lol that's nice of you (so you're the upvote on my first comment :-) ) it is so annoying to know he was waiting to understand what OP wanted, then he just sees my answer and so find in 2 sec another way of doing the same, because this is what he's good at
@RonakShah your flag probably returned helpful :-)
I am a new R user and this is my first question submission (hopefully in compliance with the protocol).
I have a data frame with two columns.
df <- data.frame(v1 = c("A", "A", "B", "B", "B", "B", "C", "D", "D", "E" ))
dfc <- df %>% count(v1)
df$n <- with(dfc, n[match(df$v1,v1)])
v1 n
1 ...
Well, I think we should try to unfocus from him, just let him be and act whatever he's pleased. Just flag inapropriate content (comments) and do the usual close/dupe when needed. And ignore him if call after you for a closure.
yep, problem is, when akrun asks OP for desired output, then I answer, then, now tha the knows what needs to be computed, he posted a different, but with a part of copying/pasting, answer, it just so much annoys me... argh... ;-)
@DavidArenburg yeah I have no idea whant I'm tlaking about (I just thought your sol would be the fastest and as it's not, I just guessed ^ must take some time...)
When you have the data set, usually you want to see that is the fraction of rows that has at least one NA (or missing value) in the data set.
In R, what I did is the following:
TR = apply(my_data,1,anyNA)
sum(TR)/length(TR)
But I found that if my data set has 1 million rows, it takes some tim...