Displaying 3 results from an estimated 3 matches for "corynissen".
2010 Nov 04
3
avoid a loop
Let's suppose I have userids and associated attributes... columns a and b
a <- c(1,1,1,2,2,3,3,3,3)
b <- c("a","b","c","a","d","a", "b", "e", "f")
so a unique list of a would be
id <- unique(a)
I want a matrix like this...
[,1] [,2] [,3]
[1,] 3 1 2
[2,] 1 2 1
[3,]
2010 Dec 20
6
sample() issue
> length(sample(25000, 25000*(1-.55)))
[1] 11249
> 25000*(1-.55)
[1] 11250
> length(sample(25000, 11250))
[1] 11250
> length(sample(25000, 25000*.45))
[1] 11250
So the question is, why do I get 11249 out of the first command and not
11250? I can't figure this one out.
Thanks
Cory
[[alternative HTML version deleted]]
2012 Mar 09
0
socket connection in while(TRUE) loop the best way?
I'm accessing R via a socket connection. I set up a connection using
socketConnection and then use readLines inside of a while(TRUE) loop to
listen for activity. Is that the best way of doing this sort of activity?
It works, that's not the issue, I am just wondering if there's a better
way.
Thanks
[[alternative HTML version deleted]]