Re: [R] A %nin% operator?

2010-08-05 Thread David Huffer
See Harrell's Hmisc package -- David Huffer, Ph.D. Deputy Director CSOSA/ORE Washington, DC -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Ken Williams Sent: Thursday, August 05, 2010 11:20 AM To: r-help@r-project.org Su

Re: [R] write file to date-stamped folder

2009-08-31 Thread David Huffer
How about: > test.table <- matrix ( rnorm ( 25 ) , ncol = 5 ) > outputDir = paste ( + getwd ( ) + , "/OutputData-" + , Sys.Date ( ) + , sep = "" + ) > dir.create ( outputDir ) > write.table ( + test.table + , paste ( + outputDir + , "test.table.txt" + , sep = "/" + ) +

Re: [R] changing equal values on matrix by same random number

2009-08-26 Thread David Huffer
== i ) , min = min , max = max ) } x } milton ( x = mymat ) -- David   ----- David Huffer, Ph.D. Senior Statistician CSOSA/Washington, DC davi

Re: [R] changing equal values on matrix by same random number

2009-08-26 Thread David Huffer
  - David Huffer, Ph.D. Senior Statistician CSOSA/Washington, DC david.huf...@csosa.gov - -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun

[R] Adding logical vectors

2009-08-13 Thread David Huffer
When adding several logical vectors I expect each vector will be coerced to integers and these vectors will then be added. That doesn't always seem to be the case. For example: > ( f1 <- as.factor ( sample ( "x" , 25 , rep = T ) ) ) [1] x x x x x x x x x x x x x x x x x x x x x x x x x Le

Re: [R] if confusion

2009-08-03 Thread David Huffer
cat ( tclass , "\n" ) } david -- David   --------- David Huffer, Ph.D. Senior Statistician CSOSA/Washington, DC david.huf...@csosa.gov - -Original Message- From: r-help-boun...@r-project.or

Re: [R] time difference

2009-07-22 Thread David Huffer
2-12 18:58:47 EST" > file1 - file2 Time difference of 157.8587 days > David -- David   - David Huffer, Ph.D. Senior Statistician CSOSA/Washington, DC david.huf...@csosa.gov __

Re: [R] assign question

2009-07-20 Thread David Huffer
How about: sapply ( 1:27 , function ( i ) { min ( get ( paste ( "sa" , i , sep = "" ) ) ) } ) See ?get david -- David   --------- David Huffer, Ph.D. Senior Statistici

Re: [R] Transformation of data!

2009-07-16 Thread David Huffer
I'm guessing you want to perform some sort of transformation on all the elements in the matrix you've posted and that you've only presented those 3 elements as an example of how the transformation will affect those 3 elements. Is that right? -- David -Original Message- From: r-help-bo

Re: [R] DataFrame help

2009-07-16 Thread David Huffer
The easiest way is to just do something like this: > mdat <- matrix(c(4,2,3, 11,12,13), nrow = 2, ncol=3) > mdat [,1] [,2] [,3] [1,]43 12 [2,]2 11 13 > as.vector ( colSums ( mdat ) ) [1] 6 14 25 > HTH -- David -Original Message- From: r-help-boun...@r-project.o

Re: [R] Problems with lists...

2009-07-16 Thread David Huffer
Like, > a = list (1:3,4:6,7:9) > a [[1]] [1] 1 2 3 [[2]] [1] 4 5 6 [[3]] [1] 7 8 9 > a [[2]] [2] [1] 5 > a [[3]] [3] [1] 9 > HTH -- David -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of voidobscura Sent: Thursday, July 16,

Re: [R] Finding missing elements by comparing vectors

2009-07-16 Thread David Huffer
Or... > X = c ("red", "blue", "green", "black" ) ; Y = c("red", "blue", "green", "magenta", "cyan") > unique ( c ( X [X %in% Y] , Y [Y %in% X] ) ) [1] "red" "blue" "green" > David -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf

Re: [R] problem with merging matrices

2009-07-15 Thread David Huffer
project.org] On Behalf Of David Huffer Sent: Wednesday, July 15, 2009 11:07 AM To: jurgen claesen; r-help@r-project.org Subject: Re: [R] problem with merging matrices On Wednesday, July 15, 2009 8:28 AM, jurgen claesen wrote: > ...I'm a relative new user of R and I have a >

Re: [R] problem with merging matrices

2009-07-15 Thread David Huffer
of the new matrix? I would have guessed i would have seen 2 7 1 8 in the corner. Was that a typo or do you really want to overwrite the values of the submatrix that *is* in A1? david -- David   - David Huffer, Ph.D. Senior Statist

Re: [R] matching each row

2009-07-08 Thread David Huffer
s ( dataframeA$unique.id , dataframeB$unique.id ) N in x N in y 3 3 1 5 1 3 7 2 1 9 1 1 > -- David   ----- David Huffer, Ph.D. Senior Statistician CSO

Re: [R] error: no such index at level 2

2009-07-08 Thread David Huffer
[1] 15750 I must be missing something. -- David   ----- David Huffer, Ph.D. Senior Statistician CSOSA/Washington, DC david.huf...@csosa.gov - -Original Message- From: r-help-boun...@r-project.org [mailto:r-hel

Re: [R] Formatting a Table

2009-07-08 Thread David Huffer
0.343 0.422 0.512 0.614 0.729 0.857 [5,] 10 0.306 0.385 0.477 0.583 0.705 0.843 Im not really sure what you mean by "Line up the first row with the factors (decimal fractions)". -- David   --------- David Huffer, Ph.D.

Re: [R] how to count number of elements in a vector that are not NA ?

2009-07-07 Thread David Huffer
to do it. Even your way is not wrong... -- David   ----- David Huffer, Ph.D. Senior Statistician CSOSA/Washington, DC david.huf...@csosa.gov __ R-help@r-project.org

Re: [R] how to count number of elements in a vector that are not NA ?

2009-07-07 Thread David Huffer
How about countN <- function ( v ) { sum ( !is.na ( v ) ) - sum ( is.na ( v ) ) } -- David   - David Huffer, Ph.D. Senior Statistician CSOSA/Washington, DC david.huf...@csosa.

Re: [R] Sweave: multiline Sexpr?

2009-06-30 Thread David Huffer
That seems like the way to go, but it seems not to take full advantage of the language. Thank you both. David -Original Message- From: Duncan Murdoch [mailto:murd...@stats.uwo.ca] Sent: Tuesday, June 30, 2009 1:16 PM To: David Huffer Cc: r-help@r-project.org Subject: Re: [R] Sweave:

[R] Sweave: multiline Sexpr?

2009-06-30 Thread David Huffer
Is there any way to have Sexpr span multiple lines? -- David   - David Huffer, Ph.D. Senior Statistician CSOSA/Washington, DC david.huf...@csosa.gov

Re: [R] SAS Macro Variable in R

2009-06-23 Thread David Huffer
"" ) destfile <- paste ( destpath , substitute ( symbol ) , ".csv" , sep = "" ) download.file ( url , destfile , quiet = TRUE ) } download.ichart ( "TEF" ) -- David   - David Huffer, Ph.D. Senior Statistician

Re: [R] IP-Address

2009-06-19 Thread David Huffer
" , "169.131.58.1" , "162.131.58.5" , "169.131.58.2" , "162.131.58.6" , "169.132.58.3" , "162.132.58.20" , "250.131.58.4" , "162.252.20.21" , "250.131.58.5" , "162.254.20.22" , "250.131.58.7&q

Re: [R] by-group processing

2009-05-08 Thread David Huffer
On Thursday, May 07, 2009 7:45 PM, David Freedman wrote: > ...how about: > d=data[order(data$ID,-data$Type),] > d[!duplicated(d$ID),] Does the "-data$Type" argument to the order function work? -- David   -----

Re: [R] read SAS file

2008-11-10 Thread David Huffer
Do you have the foreign package loaded? -- David __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contai

[R] Repository missing hmisc

2008-10-28 Thread David Huffer
I'm trying to install the Hmisc package, however it doesn't appear in the list after "utils:::menuInstallPkgs()". Any help? -- David __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide htt

Re: [R] replicating dataframe rows

2008-09-29 Thread David Huffer
On Monday, September 29, 2008 1:59, Dimitris Rizopoulos wrote: > On Monday, September 29, 2008 1:26, milton ruser wrote: > > ...I have a data.frame like... > >place<-c("place1", "place2", "place3", "place4", "place5") > >population<-c(100,200,300,50,30) > >my.df<-data.frame(cbi

[R] Most common level of a factor by

2008-08-29 Thread David Huffer
I'm looking for something along the lines of which ( table ( x ) == max ( table ( x ) ) ) to find the most common level of one factor by several other factors. For instance, I've got > X <- data.frame ( + x = factor ( sample ( c ( "A" , "B" , "C" , "D" ) , 20 , r = T ) ) + , z1 = fac

[R] Rpart description of tree groups

2008-06-17 Thread David Huffer
I'm making a few functions to generate latex files describing rpart objects that are then \input-ed into a larger document. So far, the functions I have generate paragraphs containing enumerations of the predictors in pruned trees and the number of formed groups. Its easy enough to recover these.