Re: [R] example of geom_contour() with function argument

2017-10-09 Thread jdnewmil
library(mvtnorm) # you were misusing "require"... only use require if you plan to library(ggplot2) # test the return value and fail gracefully when the package is missing set.seed( 1234 ) xx <- data.frame( rmvt( 100, df = c( 13, 13 ) ) ) xx2 <- expand.grid( X1 = seq( -5, 5, 0.1 ) # all combinati

Re: [R] run a calculation function over time fields, ordered and grouped by variables

2015-05-25 Thread jdnewmil
Another way: #create four columns with route id, stop sequence interval time and route start time ssq <- c( 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 2, 3, 4, 5, 6, 7, 8 ) tint <- c( "00:00", "00:12", "00:03", "00:06", "00:09", "00:02", "00:04" , "00:00", "00:08", "00:10", "00:10" , "0

Re: [R] elegant way to create a sequence with the 'rep' bulit-in function

2015-05-23 Thread jdnewmil
I agree with Bert. It is not clear what is generating a need for this sequence, so it is difficult to see what aspects need to be adjustable. If this specific sequence is the only one you need, then Bert's code looks "elegant" to me. One note: "c" is a base function in R. Functions in R are fi

Re: [R] pairwise linear regression between two large datasets

2012-04-02 Thread jdnewmil
If "any idea of a for loop is disastrous," why are you using apply, which is basically a for loop? I think you have framed the question in such a way that loops are inevitable. You are already using the LHS as a matrix, which is the main speedup I could think of. However, you can avoid some s

Re: [R] Help with recast() syntax

2011-11-28 Thread jdnewmil
Inline below... On Mon, 28 Nov 2011 21:32:21 -0800 (PST), Chris Conner wrote: Dear Help-Rs,   I have data similar to the following:   DF <- structure(list(X = 1:22, RESULT = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("NEG", "