Re: [R] data format issue

2008-12-20 Thread Gabor Grothendieck
Use read.zoo and aggregate.zoo from zoo and months, hours and as.chron from chron. Note that we must read in col 1 as character to ensure leading zeros don't get dropped. There are two mph columns and it is assumed you want both: Lines <- "LST inch mphDeg DegF DegF%volts D

Re: [R] data format issue

2008-12-20 Thread jim holtman
Does this do it for you: > # quick and dirty -- remove the 'mm' from the data and then aggregate > x$hours <- (x$LST %/% 100) * 100 > aggregate(x$mph, list(x$hours), mean) Group.1x 1 50601 13.82500 2 506010100 17.55000 3 506010200 23.04167 4 506010300 22.0 > > You can also 'fi

[R] data format issue

2008-12-20 Thread Sherri Heck
Dear all- I have a dataset (see a sample below - but the whole dataset is June 2005 - June 2008). The "LST" format is "YYMMDDHHmm" and I would like to get the hourly average of the "mph" for the summer months (spanning all years). I have been trying to use "aggregate" but am not having much

Re: [R] Calculating Sensitivity, Specificity, and Agreement from Logistics Regression Model

2008-12-20 Thread Frank E Harrell Jr
Felix Schönbrodt wrote: *Von: *Frank E Harrell Jr > *Datum: *18. Dezember 2008 14:49:53 MEZ *An: *Meir Preiszler > *Kopie: *r-h...@r-project.org *Betreff: **Re: [R] Calculating Sensitivity, Specificit

Re: [R] NA, where no NA should (could!) be!

2008-12-20 Thread David Winsemius
On Dec 20, 2008, at 6:26 PM, Oliver Bandel wrote: Hello, ok, I found the problem! I now have: res_size_by_host <- tapply( selected$size, factor(selected$host), sum) instead of res_size_by_host <- tapply( selected$size, selected$host, sum) and now it works. IMHO this is stran

Re: [R] NA, where no NA should (could!) be!

2008-12-20 Thread Peter Dalgaard
Oliver Bandel wrote: Hello, ok, I found the problem! I now have: res_size_by_host <- tapply( selected$size, factor(selected$host), sum) instead of res_size_by_host <- tapply( selected$size, selected$host, sum) and now it works. IMHO this is strange, because selected$host is

[R] ANNOUNCEMENT: February Short Course - Regression Modeling Strategies

2008-12-20 Thread Frank E Harrell Jr
REGRESSION MODELING STRATEGIES presented by Frank E. Harrell, Jr., Ph.D. Professor and Chair Department of Biostatistics Vanderbilt University School of Medicine February 2 - 6, 2009 Vanderbilt University Medical Center Campus Five-Session Short Course by Frank Harrell, Jr., Ph.D., Professor a

Re: [R] How to do indexing after splitting my data-frame?

2008-12-20 Thread jim holtman
'str' is your friend when trying to understand what the difference is: > x <- data.frame(a=1:10, b=sample(1:2, 10, TRUE)) > x.s <- split(x, x$b) > > x.s $`1` a b 1 1 1 2 2 1 5 5 1 10 10 1 $`2` a b 3 3 2 4 4 2 6 6 2 7 7 2 8 8 2 9 9 2 > str(x.s['1']) List of 1 $ 1:'data.frame': 4

Re: [R] NA, where no NA should (could!) be!

2008-12-20 Thread Oliver Bandel
Hello, ok, I found the problem! I now have: res_size_by_host <- tapply( selected$size, factor(selected$host), sum) instead of res_size_by_host <- tapply( selected$size, selected$host, sum) and now it works. IMHO this is strange, because selected$host is already a factor! I do

Re: [R] NA, where no NA should (could!) be!

2008-12-20 Thread Oliver Bandel
Oliver Bandel first.in-berlin.de> writes: [...] > > P.S.: I will try to attach my zip-file now... it contains > the complete code and a changed weblog (changed IP-addresses). > I hope the list accepts it. [...] As assumed, this did not work. But I found, where the problem might be

Re: [R] NA, where no NA should (could!) be!

2008-12-20 Thread Oliver Bandel
Zitat von Peter Dalgaard : > Oliver Bandel wrote: > > Sarah Goslee gmail.com> writes: > > > >> I think we need the reproducible example requested in > >> the posting guide. > > > > > > for ( datum in names(weblog_by_date) ) > > { > > print(datum) > > selected <- weblog_by

Re: [R] NA, where no NA should (could!) be!

2008-12-20 Thread Peter Dalgaard
Oliver Bandel wrote: Sarah Goslee gmail.com> writes: I think we need the reproducible example requested in the posting guide. for ( datum in names(weblog_by_date) ) { print(datum) selected <- weblog_by_date[[datum]] res_size_by_host <- tapply( selected$size, sel

Re: [R] autologistic modelling in R

2008-12-20 Thread David Katz
Curiosity and Google lead me to this paper which may be of interest: Assessing the validity of autologistic regression Purchase the full-text article References and further reading may be available for this article. To view references and further reading you must purchase this article. Carste

Re: [R] NA, where no NA should (could!) be!

2008-12-20 Thread Oliver Bandel
Sarah Goslee gmail.com> writes: > > I think we need the reproducible example requested in > the posting guide. for ( datum in names(weblog_by_date) ) { print(datum) selected <- weblog_by_date[[datum]] res_size_by_host <- tapply( selected$size, selected$host, sum)

Re: [R] NA, where no NA should (could!) be!

2008-12-20 Thread Sarah Goslee
I think we need the reproducible example requested in the posting guide. Sarah On Sat, Dec 20, 2008 at 4:42 PM, Oliver Bandel wrote: > Hello, > > again I'm on my weblog-script... having problems... > > > > > This code: > > === > weblog <- read_weblog("web.log") > weblog_b

Re: [R] Merging data frames of different length

2008-12-20 Thread Dimitri Liakhovitski
Thanks a lot, Gabor - it's perfect! Dimitri On Fri, Dec 19, 2008 at 6:24 PM, Gabor Grothendieck wrote: > Try this: > >> L <- list(data.frame(A=2, B=3, C=4), > + data.frame(A=2, B=1, C=3, D=2, E=4, F=5), > + data.frame(A=1, B=2, C=4, D=3, E=2, F=4, G=5, H=4, I=2)) > >> library(plyr) >> do.call(rbi

[R] NA, where no NA should (could!) be!

2008-12-20 Thread Oliver Bandel
Hello, again I'm on my weblog-script... having problems... This code: === weblog <- read_weblog("web.log") weblog_by_date <- split(weblog, weblog$date) #for ( i in names(weblog_by_day) ) { print(i); print(weblog_by_day$i) } for ( datum in names(weblog_by_date) ) { p

Re: [R] Print a list in columns

2008-12-20 Thread David Winsemius
Perhaps not the most elegant solution, but this seems to "work". > a<- rnorm(5) > b <- rnorm(10) > clis <- list(a,b) > dput(clis, "testfile") # writes to file #dput works for arbitrary structures Now pad the shorter of the vectors with NA's and "print" the result of cbind > mv <-max(length(cl

[R] SAS LMM to lme syntax

2008-12-20 Thread Pedro Mardones
Dear all; I have the following SAS code: proc mixed data=mydata covtest asycov update; class rep cross; model ht = rep; random col1-col5 / type=toep(1); random cross/type=vc; ods output covparms=_varcomp asycov=_cov; run; where col1-col5 are columns of 0 and 1 (Z matrix of dummy variables) w

Re: [R] How to do indexing after splitting my data-frame?

2008-12-20 Thread Oliver Bandel
Hello Jim, jim holtman gmail.com> writes: > > try: > > myindex <- "01-Dec-2008" > > weblog_by_date[[myindex]]$host [...] Ooops yes, that works! Thank you! I don't know why this works, and the other thing not. I thought the difference between [] and [[]] is just, that the one gives back

Re: [R] How to do indexing after splitting my data-frame?

2008-12-20 Thread jim holtman
try: myindex <- "01-Dec-2008" weblog_by_date[[myindex]]$host On Sat, Dec 20, 2008 at 3:35 PM, Oliver Bandel wrote: > Hello, > > after splitting a data-frame I want to access the results. > > Maybe the problem is, that the factor/index is a string... > > ...or do I miss knowing details of the in

[R] How to do indexing after splitting my data-frame?

2008-12-20 Thread Oliver Bandel
Hello, after splitting a data-frame I want to access the results. Maybe the problem is, that the factor/index is a string... ...or do I miss knowing details of the index-uasge? Please look and help: === > weblog <- read_weblog("web.log") > > > str(weblog) 'd

Re: [R] Calling an R Exit Function

2008-12-20 Thread Phil Rack
Thank You Sarah! With your help, I was able to use the .Last function along with options (error = .Last) to get what I wanted. So basically the new code that I need to add to my process looks like: .Last <- function() { cat("File Completed - WPS2R1 \n",file = "D:\\WPSWork\\WPS Temporar

Re: [R] Print a list in columns

2008-12-20 Thread Adam D. I. Kramer
Hi Borja, write.table doesn't work, because it's not clear how to print it in two columns, so we can't help you yet either. Do you want to match the first item in v1 with the first item in v2, and have a bunch of NAs hanging off the end of the shorter column in the output? Or align the

[R] Print a list in columns

2008-12-20 Thread Borja Soto Varela
Dear R-Users I have a list with two vectors of doubles tha have different lengths. I want to export it to a file and I also want to print it in two columns. I try with write.table but it need vectors of the same length. Does anyone know how to do it? Thanks Borja [[alternative HTML ver

Re: [R] Specify nonlinear equation with nlme

2008-12-20 Thread Dieter Menne
justin bem yahoo.fr> writes: > I want to estimate a nonlinear mixed effect model using nlme package or lme4. How can I specify this > > y=exp(B'X)/(1+exp(B'X)). the same model can be obtained with logit(y)=B'X but I have many value of 1 in y logit(1)=Inf. Using exp in this case is a fairly com

Re: [R] How test contrasts/coefficients of Repeated-Measures ANOVA?

2008-12-20 Thread Dieter Menne
Ben Meijering student.rug.nl> writes: > I'm doing a Repeated-Measures ANOVA, but I don't know how to test its > contrasts or where to find the p-values of its coefficients. I know > how to find the coefficient estimates of a contrast, but not how to > test these estimates. > > First I do s

Re: [R] understanding lexical scope

2008-12-20 Thread Peter Dalgaard
Wacek Kusnierczyk wrote: Peter Dalgaard wrote: One distinction is if you have things like #define f(x) 2*x #define g(y) f(y+2) (in the C language preprocessor syntax), then you end up with g(y) as y+2*2 (i.e., y+4), whereas the corresponding function calls give 2*(y+2). Also, and the flip side

[R] How test contrasts/coefficients of Repeated-Measures ANOVA?

2008-12-20 Thread Ben Meijering
Hi all, I'm doing a Repeated-Measures ANOVA, but I don't know how to test its contrasts or where to find the p-values of its coefficients. I know how to find the coefficient estimates of a contrast, but not how to test these estimates. First I do something like: y.aov <- aov(y ~ fac1 * f

Re: [R] R/OCaml?

2008-12-20 Thread Oliver Bandel
Hello Alexy, Alexy Khrabrov gmail.com> writes: > > Did anyone try to write R extensions in OCaml? What would it entail > to enable it? [...] I did not so far, but I have thought about it. It must be done via C as glue-code. So it is necessary to be able to write C-extensions for OCaml (o

Re: [R] Calling an R Exit Function

2008-12-20 Thread Sarah Goslee
What about .Last() ? You can implement a system-wide version - I'm assuming that is possible on Windows. Sarah On Sat, Dec 20, 2008 at 8:52 AM, PhilRack wrote: > > I'm looking for advice and suggestions on how I might be able to implement a > routine when R exits. First, I'm running on Windows X

[R] Calling an R Exit Function

2008-12-20 Thread PhilRack
I'm looking for advice and suggestions on how I might be able to implement a routine when R exits. First, I'm running on Windows XP SP2 using R 2.7.1. I have a series of R programs that run numerous times a day. At the end of each program, I have a call that appends a line of text to another file

Re: [R] error bars

2008-12-20 Thread Sarah Goslee
Hi, These are rather basic; I'd strongly suggest that you at least read An Intro to R, and maybe some of the other excellent beginner materials available. The answers are also easily available through Google, or RSiteSearch. > 1) rotating the numbers on axes...something to do with par(str) ?? Th

Re: [R] bug (?!) in "pam()" clustering from fpc package ?

2008-12-20 Thread Martin Maechler
> "TG" == Tal Galili > on Sat, 20 Dec 2008 12:20:49 +0200 writes: TG> Thanks for the clarification Christian. For future TG> people who will search, I did eventually found a way to TG> do Kmeans with manhattan distances, by using: the TG> "cclust" command (from the cc

Re: [R] understanding lexical scope

2008-12-20 Thread Wacek Kusnierczyk
Peter Dalgaard wrote: > > One distinction is if you have things like > > #define f(x) 2*x > #define g(y) f(y+2) > > (in the C language preprocessor syntax), then you end up with g(y) as > y+2*2 (i.e., y+4), whereas the corresponding function calls give > 2*(y+2). Also, and the flip side of the orig

Re: [R] understanding lexical scope

2008-12-20 Thread Wayne F
joseph.g.boyer wrote: > > Thomas, Jeff, Mark, Antonio, > > Thank you for your answers. They have helped me clarify how R functions > work. They work differently from SAS functions (which SAS calls macros.) > > To me, while the coding is quite awkward, the execution is logical. The > variabl

Re: [R] understanding recursive functions

2008-12-20 Thread joseph . g . boyer
Jeffrey and Jeff, Thank you for clearing this up. The problem was that I didn't read page 47 of the guide carefully. The introduction of the <<- operator on page 44 leaves me with the impression that <<- will create an assignment in the local environment THAT ALSO holds true for the next higher

Re: [R] how to manipulate ... within a function

2008-12-20 Thread Dan Kelley
Thanks very much, Duncan. In case it's of interest to others who encounter this thread later, I am pasting below the code I wrote. It is for the 'oce' package for oceanographic data, which explains the reversal of the y axis, forming a so-called 'profile', in which the top of the graph represent

[R] What BIC is calculated by 'regsubsets'?

2008-12-20 Thread Paul Murtaugh
The function 'regsubsets' appears to calculate a BIC value that is different from that returned by the function 'BIC'. The latter is explained in the documentation, but I can't find an expression for the statistic returned by 'regsubsets'. Incidentally, both of these differ from the BIC that

[R] How to plot arrows for a PLS plot with ggplot2?

2008-12-20 Thread Josep Maria Campanera Alsina
Dear community, I'd like to build a PLS plot with scores and loadings, sometimes called "biplot". Like in biplot.mvr {pls} but using ggplot2. 1. Scores plot. No problem! ggplot(data=data1,aes(x=plsr1,y=plsr2))+geom_point(aes(colour=solenergy,shape=type))+geom_text(aes(label=res,size=1,hjust=0,vjus

[R] Specify nonlinear equation with nlme

2008-12-20 Thread justin bem
Dear all, I want to estimate a nonlinear mixed effect model using nlme package or lme4. How can I specify this y=exp(B'X)/(1+exp(B'X)). the same model can be obtained with logit(y)=B'X but I have many value of 1 in y logit(1)=Inf. Justin BEM BP 1917 Yaoundé Tél (237) 99597295 (237) 220402

[R] error bars

2008-12-20 Thread Kelly-Gerreyn B.A.
Dear Help I'm new to R (from matlab)...using windows XP. I've tried to work out, to no avail, 4 things: 1) rotating the numbers on axes...something to do with par(str) ?? 2) how to close a window having opened one e.g. windows(7,7) 3) how to manipulate the key (e.g. dots, lines etc) on the leg

Re: [R] understanding lexical scope

2008-12-20 Thread Peter Dalgaard
Nordlund, Dan (DSHS/RDA) wrote: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of joseph.g.bo...@gsk.com Sent: Friday, December 19, 2008 7:41 AM To: Thomas Lumley Cc: r-help@r-project.org Subject: Re: [R] understanding lexical scop

Re: [R] bug (?!) in "pam()" clustering from fpc package ?

2008-12-20 Thread Tal Galili
Thanks for the clarification Christian. For future people who will search, I did eventually found a way to do Kmeans with manhattan distances, by using: the "cclust" command (from the cclust package) (where the parameter to change is "dist": dist- If "euclidean", then mean square error, i

Re: [R] How to write a Surv object to a csv-file?

2008-12-20 Thread Heinz Tuechler
Dear Charles, yes, your solution does what I need. Maybe, it offers also a way to use the compare package with Surv objects. Thank you, Heinz At 23:30 19.12.2008, Charles C. Berry wrote: On Fri, 19 Dec 2008, Heinz Tuechler wrote: Dear David! Thank you for your response. I like csv files,

Re: [R] Calculating Sensitivity, Specificity, and Agreement from Logistics Regression Model

2008-12-20 Thread Felix Schönbrodt
> Von: Frank E Harrell Jr > Datum: 18. Dezember 2008 14:49:53 MEZ > An: Meir Preiszler > Kopie: r-help@r-project.org > Betreff: Re: [R] Calculating Sensitivity, Specificity, and Agreement > from Logistics Regression Model > > > Meir Preiszler wrote: >> Hi, >> Assume I have a variable Y having t