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

05:12
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 .
05:53
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
06:13
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))))
06:36
@Sotos ahh..yes!
thanks :)
yup :)
07:09
happy friday all :-)
07:32
Hello
@Cath to you too!
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
@RomanLuštrik voted, but it was deleted by op, and re-asked... so he got the hate :)
11:19
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…
14:37
When the reproducible example of a question is assigned as df8, you know they tried hard to solve it :D
 
3 hours later…
17:18
@RonakShah They're also highly upvoted but not particularly good questions or answers
 
2 hours later…
18:56
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…
20:49
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 (1918 days later) »