« first day (1605 days earlier)      last day (1693 days later) » 

5:12 AM
This has been troubling me for long time now. I think I have seen the solution to this somewhere but can't recollect the way to solve this. Consider a vector x <- c(2, 3, 4, NA, 2, NA)
I want to replace NA values with random non-NA values from the vector. I am trying

ifelse(is.na(x), sample(x[!is.na(x)], sum(is.na(x))), x)

but this replaces with same non-NA value for all .
 
5:53 AM
x <- c(2, 3, 4, NA, 2, NA)
s <- x[!is.na(x)]
na_idx <- is.na(x)
x[na_idx] <- sample(s, size = sum(na_idx), replace = T)
x
not a concise one-liner, but I think it works
 
6:13 AM
I guess that is the only way to do. Thanks :)
 
morning all
@RonakShah replace seems to be working... replace(x, is.na(x), sample(x[!is.na(x)], sum(is.na(x))))
 
6:36 AM
@Sotos ahh..yes!
thanks :)
 
yup :)
 
7:09 AM
happy friday all :-)
 
7:32 AM
Hello
@Cath to you too!
 
7:50 AM
Some are really effed up, sigh
 
hello
 
People are a violent species. Maybe not since the dawn of time, but violent people have been naturally selected to rule the world. So here we are.
 
 
2 hours later…
is it okay if you and your friends decide and ask question and post answer as well
the post was answered within a minute for both the case
 
Sure, why not. It is useful for posterity, even if marginally.
Can we undelete the first question? stackoverflow.com/questions/57883496/…
 
yeah..I guess! We do encourage people to self-answer so this is kind of similar.
 
I doubt they'be able to hedge the SO system if a few friends start pair posting. :)
The above question is arguably bad, but not so terrible that it should be deleted.
(We deleted the second duplicate question from the same user)
 
10:35 AM
@RomanLuštrik voted, but it was deleted by op, and re-asked... so he got the hate :)
 
11:19 AM
That's why I think the second question should be deleted and the first one reopened. They don't differ in content significantly.
The first one was deleted, according to OP, because he had problems with formatting. That's hardly a reason to delete and ask a new question.
 
 
3 hours later…
2:37 PM
When the reproducible example of a question is assigned as df8, you know they tried hard to solve it :D
 
 
3 hours later…
5:18 PM
@RonakShah They're also highly upvoted but not particularly good questions or answers
 
 
2 hours later…
6:56 PM
I marked a question as a duplicate. The OP confirmed it and the question was closed. 3 minutes later a certain someone reopened it stackoverflow.com/posts/57927497/revisions
 
 
2 hours later…
8:49 PM
The only thing worse than a screenshot of code is a photo of a computer screen stackoverflow.com/q/57924044/5325862
 

« first day (1605 days earlier)      last day (1693 days later) »