search for: gerlanc

Displaying 6 results from an estimated 6 matches for "gerlanc".

2006 Aug 04
2
Sampling from a Matrix
...10 0.37 0.1960 0.205 I want to sample 3 values from each row. One way to do this follows: index <- 1:ncol(probs) for(i in 1:nrow(probs)){ ## gets the indexes of the values chosen sample(index, size = 3, replace = TRUE, prob = probs[i, ]) } Is there a another way to do this? Thanks! Dan Gerlanc -- Daniel Gerlanc Williams College '07
2007 Sep 14
2
Building an R GUI using gWidgets and RGtk2
...ut it appears to provide similar OO features to Java. Because it allows references, it would seem to provide the features I'm looking for from both the S4 and functional approaches. Any comments or suggestions on these different approaches would be appreciated. Thank you. Sincerely, Daniel Gerlanc
2006 Jul 14
1
Splitting the left and right hand terms of a formula
...c("y", "z") One way to do this follows: left.hand.side <- unlist(dimnames(attr(terms(a.formula), "factors"))[1]) right.hand.side <- unlist(dimnames(attr(terms(a.formula), "factors"))[-1]) Is there a better or cleaner way to do this? Thanks! Daniel Gerlanc Williams College '07
2009 Aug 05
7
why is 0 not an integer?
Why when I assign 0 to an element of an integer vector does the type change to numeric? Here is a particularly perplexing example: > v <- 0:10 > v [1] 0 1 2 3 4 5 6 7 8 9 10 > class(v) [1] "integer" > v[1] <- 0 > class(v) [1] "numeric" #!! > -- View this message in context:
2009 Aug 05
7
why is 0 not an integer?
Why when I assign 0 to an element of an integer vector does the type change to numeric? Here is a particularly perplexing example: > v <- 0:10 > v [1] 0 1 2 3 4 5 6 7 8 9 10 > class(v) [1] "integer" > v[1] <- 0 > class(v) [1] "numeric" #!! > -- View this message in context:
2006 Jul 25
1
Follow Up To: Splitting the left and right hand terms of a formula
...cts of class "formula" for the left and right hand sides of the formula. To get the right hand side or left hand side I wrap one of these method calls in a call to "all.vars". Is there a better way to get the left or right hand side of the formula, or is this it? Thanks! Dan Gerlanc Williams College