Re: [R] Count data with several numbers separated by commas

2009-04-15 Thread Simon Blomberg
Here's a solution, though it may be overcomplicated. I assume the data frame is called "dat": vec <- unlist(lapply(strsplit(dat$x1, ","), function (x) summary(as.factor(x > table(names(vec)) 1 2 3 4 5 9 6 2 2 8 Cheers, Simon. On Thu, 2009-04-16 at 13:03 +0700, Xiyan Lon wrote: > Dear a

Re: [R] Genstat into R - Randomisation test

2009-04-15 Thread Meyners, Michael, LAUSANNE, AppliedMathematics
Robert, Tom, Peter and all, If I remember correctly (don't have my copy at hand right now), Edgington and Onghena differentiate between randomization tests and permutation tests along the following lines: Randomization test: Apply only to randomized experiments, for which we consider the theoret

Re: [R] Sweave and executive summaries

2009-04-15 Thread Dieter Menne
bd.com> writes: >I'm learning to use R/Sweave/LaTeK to write my stat reports. Is there a > way >to have an executive summary in the beginning while still having the >analysis code embedded? Thanks to Ulrich Dietz from the German latex forum, I have an excellent solution that

[R] Count data with several numbers separated by commas

2009-04-15 Thread Xiyan Lon
Dear all, I have a data file with 3 variables (x1, x2, x3) where variable x1 have data that consists of several numbers separated by commas. id name x1 x2x3 aa1011,4,52 1 aa1021,2,51 2 aa1031,2,51 1 aa1041,2,31 2 aa1051,5 2 2

[R] Garchoxfit output

2009-04-15 Thread Vasileios Ismyrlis
Dear all, I have a problem with the garchOxFit output. I want to display only the value of max.like.est and the information criteria. How can I do that; I enclose a part of GarchOxFit output, which is what I want to display. Best regards, Vasilios Ismyrlis GarchOxFit output No. Observations :

[R] specifying anova error terms

2009-04-15 Thread James Prentice
I am wanting to do an analysis of variance on the following data (a snippet of a larger dataset) to determine whether the factor BirdCall has a significant effect on Responses. LocationTimeBirdCallResponses field1morninghuman3 field1eveninghuman5

Re: [R] From daily series to monthly and viceversa

2009-04-15 Thread Gabor Grothendieck
You can remove missing values with: zm <- aggregate(cambio, as.yearmon, mean, na.rm = TRUE) Its not clear what your second question is asking. If you want the series to have a Date class rather than yearmon class with the 1st of the month then: zd <- zm time(zd) <- as.Date(time(zm)) or zd <-

Re: [R] mean fold change issues and p values

2009-04-15 Thread David Winsemius
I am not quite sure what you are trying to do because the phrase "mean fold change values" is not in my experience. I am guessing that it is referring to some sort of geometric mean or multiplicative model. The lengthy code looks very much like a rendition of a Fortran procedure rather than

Re: [R] Sweave and executive summaries

2009-04-15 Thread Michael Kubovy
Hi Karen, Once you've run your .Rnw file once, and (say) assigned the output of a lm(y ~ x) to m1, you can add your summary at the beginning of your .Rnw file and output quantities such as the intercept (to be produced "later") using $\Sexpr{round(as.numeric(coef(m1)[1]), 3)}$ (it's a good

[R] [R-pkgs] [ANN] plyr version 0.1.7

2009-04-15 Thread hadley wickham
plyr is a set of tools for a common set of problems: you need to break down a big data structure into manageable pieces, operate on each piece and then put all the pieces back together. For example, you might want to: * fit the same model to subsets of a data frame * quickly calculate summary

[R] Transfer data

2009-04-15 Thread Romildo Martins
Hi, I need transfer data from vector("list", 6) to array(dim=c(6)) (example: x receives data from tipo[[1]] ). Thanks tipo <- vector("list", 6) tipo [[1]] [1] 1 2 3 5 6 [[2]] [1] 4 8 9 14 [[3]] [1] 7 10 11 12 [[4]] [1] 13 15 16 [[5]] NULL [[6]] NULL x <- array(dim=c(6))

Re: [R] problem with read.table

2009-04-15 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of x > Sent: Wednesday, April 15, 2009 2:43 PM > To: r-help@r-project.org > Subject: Re: [R] problem with read.table > > > I forgot to show that my file indeed contains x, y values:

Re: [R] Looping through file names and loading...

2009-04-15 Thread Duncan Murdoch
greggal...@gmail.com wrote: Dear R-Community: I am assisting a community college instructor in an introductory statistics class. He has asked me to do this: Read in a file, of filenames, line by line: Student_models.txt : (contains 1500+ filenames) Experiment_name_stu

Re: [R] problem with read.table

2009-04-15 Thread x
attach() fixed the problem. Thanks!! --- On Wed, 4/15/09, Talita Perciano wrote: > From: Talita Perciano > Subject: Re: [R] problem with read.table > To: to_rent_2...@yahoo.com > Cc: r-help@r-project.org > Date: Wednesday, April 15, 2009, 6:04 PM > I agree with Daniel J. Nordlund that the pro

Re: [R] problem with read.table

2009-04-15 Thread Talita Perciano
I agree with Daniel J. Nordlund that the problem must be that you are not attaching the data to directly access x and y. Try to do that with attach(data_model.df) right after reading the data. Talita 2009/4/15 x > > I forgot to show that my file indeed contains x, y values: > > x y > 1

Re: [R] p-values from bootstrap - what am I not understanding?

2009-04-15 Thread Viechtbauer Wolfgang (STAT)
Some useful comments have already been made. I would like to comment on the two definitions of the p-value under (4) -- since I thought exactly about this issue a while back. Maybe this will be useful ... Suppose the distribution of a test statistic Z under H0 is given by f(Z) and that the distrib

[R] Looping through file names and loading...

2009-04-15 Thread greggallen
Dear R-Community: I am assisting a community college instructor in an introductory statistics class. He has asked me to do this: Read in a file, of filenames, line by line: Student_models.txt : (contains 1500+ filenames) Experiment_name_student_name_date_time_Model_numb

Re: [R] problem with read.table

2009-04-15 Thread x
I forgot to show that my file indeed contains x, y values: x y 1 8.2 2 18 3 -17.6 4 -3.4 5 6.8 6 11.3 7 1.5 8 11 9 -3.3 10 8.1 --- On Wed, 4/15/09, x wrote: > From: x > Subject: RE: [R] problem with read.table > To: r-help@r-pr

Re: [R] From daily series to monthly and viceversa

2009-04-15 Thread manta
Ok, using mcambio <- aggregate(cambio, as.yearmon, mean) works perfectly!! Should I worry about the missing values or not anyway? And then I go to the following question. From monthly data to daily using a specific formula? -- View this message in context: http://www.nabble.com/From-daily-seri

Re: [R] From daily series to monthly and viceversa

2009-04-15 Thread manta
Ok, thanks for the quick reply. I was not able to use the first command, but reading the quick reference helped me. Here's what I did. > cambio<-read.zoo("C:\\Users\\Manta\\Desktop\\useuro.txt", format = > "%d/%m/%Y", dec = ",",header=T) > cambio #this is what i get 1996-01-01 1996-01-02 1996-01-

Re: [R] problem with read.table

2009-04-15 Thread x
Thank you for the reply. That format works but since I need access to x, y subsequent to lm() also, I tried the following but now I'm back to the same old error message of "object y not being found". data_model.df = read.table("./verify.txt", header=TRUE, nrows=10); dd = datadist(data_model.df)

Re: [R] Citing R

2009-04-15 Thread Tom Backer Johnsen
Stephan Kolassa wrote: citation() Really obvious. Sorry. Tom HTH, Stephan Tom Backer Johnsen schrieb: What is the correct citation to R in BibTeX format? I have looked in the R pages but so far without any luck. Tom __ R-help@r-project.org m

Re: [R] problem with read.table

2009-04-15 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of x > Sent: Wednesday, April 15, 2009 1:54 PM > To: r-help@r-project.org > Subject: [R] problem with read.table > > > Hi all, > > I've simple code to read a file (verify.txt in th

Re: [R] How to extract p-value into a table from a groups of t test

2009-04-15 Thread Bert Gunter
Everything in R is an object! ?str z <- t.test(x,y,...) str(z) Bert Gunter Genentech Nonclinical Biostatistics 650-467-7374 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jun Shen Sent: Wednesday, April 15, 2009 1:30 PM To: r

[R] problem with read.table

2009-04-15 Thread x
Hi all, I've simple code to read a file (verify.txt in the same directory as the script file) but when I run this I get "Error in eval(expr, envir, enclos) : object "y" not found". data_model.df = read.table("./verify.txt", header=TRUE, nrows=10); f <- lm(y ~ x) Could someone pls tell me what

Re: [R] Citing R

2009-04-15 Thread Stephan Kolassa
citation() HTH, Stephan Tom Backer Johnsen schrieb: What is the correct citation to R in BibTeX format? I have looked in the R pages but so far without any luck. Tom __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

[R] How to extract p-value into a table from a groups of t test

2009-04-15 Thread Jorge Ivan Velez
Dear Jun, Try this: do.call(c,lapply(your_list_with_the_t_tests,function(x) x$p.value)) HTH, Jorge On Wed, Apr 15, 2009 at 4:29 PM, Jun Shen wrote: > Hi, > > I have run a groups of t test and obtained a list of the t-test results > (about 30). How do I extract p-values from the 30 t-test r

Re: [R] Citing R

2009-04-15 Thread Duncan Murdoch
On 4/15/2009 4:42 PM, Tom Backer Johnsen wrote: What is the correct citation to R in BibTeX format? I have looked in the R pages but so far without any luck. > citation() To cite R in publications use: R Development Core Team (2008). R: A language and environment for statistical computin

[R] Citing R

2009-04-15 Thread Tom Backer Johnsen
What is the correct citation to R in BibTeX format? I have looked in the R pages but so far without any luck. Tom __ 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.

[R] How to extract p-value into a table from a groups of t test

2009-04-15 Thread Jun Shen
Hi, I have run a groups of t test and obtained a list of the t-test results (about 30). How do I extract p-values from the 30 t-test results and make a table output? Thanks Jun Example t-test output: $Lambda_z Welch Two Sample t-test data: x[PA1.BS.DN$Onec

Re: [R] From daily series to monthly and viceversa

2009-04-15 Thread Gabor Grothendieck
Try this: > Lines <- "31/12/1993 1,12509 + 03/01/1994 1,12509 + 04/01/1994 1,12558 + 05/01/1994 1,1258 + 06/01/1994 1,12596 + 07/01/1994 1,12753 + 10/01/1994 1,1273 + 11/01/1994 1,12416 + 12/01/1994 1,1275" > library(zoo) > z <- read.zoo(textConnection(

Re: [R] Controlling widths in write.fwf()

2009-04-15 Thread Vemuri, Aparna
I was trying to format and write each line while looping over the entire matrix; which made it terribly slow. Without the loop, it works fine. Thanks Duncan. -Original Message- From: Duncan Murdoch [mailto:murd...@stats.uwo.ca] Sent: Wednesday, April 15, 2009 10:04 AM To: Vemuri, Aparna

[R] Lattice xyplot with text under x-axis

2009-04-15 Thread kate.m
Hi All, I have a data set which I need to plot and show the values of one of the variables as a second x-axis. library(lattice) year<-c(2001,2002,2003,2004,2005,2006) fac<-c("arts","arts","arts","sci","sci","sci") staff<-c(95,98,99,32,31,36) part<-c(32,31,33,15,16,14) df1<-data.frame(year,fac,st

[R] From daily series to monthly and viceversa

2009-04-15 Thread manta
I have the following daily exchange rate series (from january 1st 1996 to december 31st 2008) and I want to obtain them monthly series from it. I've read about the 'zoo' library but I'm not getting it how to do it. These are the data (left column day-month-year, right column the index) 31/12/199

Re: [R] Equivalent to Stata egen

2009-04-15 Thread David Winsemius
Peter Kraglund Jacobsen kraglundjacobsen.dk> writes: > > What are the R equivalents to the Stata command egen? > > egen temp = anycount(t0vas t30vas t60vas t120vas t240vas t360vas), > values(0,1,2,3,4,5,6,7,8,9,10) > egen temp2 = rowtotal(t0vas t30vas t60vas t120vas t240vas t360vas) > And peo

Re: [R] import from stata

2009-04-15 Thread Dwayne Blind
Thank you very much Jorge, Phil and Stas. It is not the first time Phil ;-) 2009/4/15 Stas Kolenikov > You need a full name in quotes: > > auto <- read.dta("C:/Stata10/ado/base/a/auto.dta") > > works just fine on my computer. > > On 4/14/09, Dwayne Blind wrote: > > Dear R users, > > > > I am

Re: [R] nls factor

2009-04-15 Thread Manuel Morales
On Wed, 2009-04-15 at 12:02 -0400, Michael A. Miller wrote: > > "Manuel" == Manuel Morales writes: > > > nls(y ~ a[fac]*x^b, start=list(a=c(1,1), b=0.25)) > > Did you mean a[f]? > > nls(y ~ a[f]*x^b, start=list(a=c(1,1), b=0.25)) > > Mike Argh!!! -- http://mutualism.williams.edu __

Re: [R] (hopefully) simple array op

2009-04-15 Thread baptiste auguie
Do you want abind? http://cran.r-project.org/web/packages/abind/index.html baptiste On 15 Apr 2009, at 19:33, Cable, Samuel B Civ USAF AFMC AFRL/RVBXI wrote: I have a multidimensional array "a", for example, a , , 1 [,1] [,2] [1,]13 [2,]24 , , 2 [,1] [,2] [1,]

[R] (hopefully) simple array op

2009-04-15 Thread Cable, Samuel B Civ USAF AFMC AFRL/RVBXI
Regarding my last mail, I typed too soon. Figure I can do > a<-array(c(a,b),dim=c(2,2,3)) Seems to work fine. But I would like to hear other ideas if you have any. In particular, I am going to have to do this operation over and over. That last index "3" will have to increase by one every time

[R] (hopefully) simple array op

2009-04-15 Thread Cable, Samuel B Civ USAF AFMC AFRL/RVBXI
I have a multidimensional array "a", for example, > a , , 1 [,1] [,2] [1,]13 [2,]24 , , 2 [,1] [,2] [1,]57 [2,]68 So a is 2x2x2. I have another array "b", for example, > b [,1] [,2] [1,]9 11 [2,] 10 12 So b is 2x2. I want to "tack" b

Re: [R] scatterplot3d

2009-04-15 Thread Uwe Ligges
See ?scatterplot3d and learn to specify the argument type="h" Uwe Ligges Eric Erickson wrote: Dear R-help, I am having trouble with your scatterplot3d program. For help with this problem I was directed to your address by Martin Maechler at " r-core-boun...@r-project.org." I'm also sending

Re: [R] Compiling Fortran Subroutines as R Shared Objects on Mac OS-X

2009-04-15 Thread cls59
Chad R. Bhatti wrote: > > > Hello, > > I am trying to compile some F77 subroutines as shared objects for R on my > Mac. > --> Mac OS-X Version 10.4.11 (Tiger Intel Mac) > > > > chad-r-bhattis-computer:~/MyR/Examples/Fortran/Test1 chadrbhatti$ R CMD > SHLIB two.f > gfortran -arch i386 -fP

Re: [R] How to apply a function to all combinations of the values of 2 or more variables?

2009-04-15 Thread Lane, Jim
Phil: thank you very much, that's exactly what I was looking for! Why I couldn't have figured that out from the doc for myself is another question:-) -Jim -Original Message- From: Phil Spector [mailto:spec...@stat.berkeley.edu] Sent: 2009, April, 15 1:21 PM To: Lane, Jim Subject: Re: [

[R] Sweave and executive summaries

2009-04-15 Thread Karen_Byron
I'm learning to use R/Sweave/LaTeK to write my stat reports. Is there a way to have an executive summary in the beginning while still having the analysis code embedded? For example, a study has three independent objectives so I want my report to have three sections. Ideally the

Re: [R] using Sweave, how to save a plot in a given size

2009-04-15 Thread cls59
Lo_Lo wrote: > > > I just want to add that I didn't have any overful box before I use : > > <>= > pdf("fig1.pdf", > width = wid, heigth = hei) > plot(1:10) > plot(1:10) > dev.off() > cat("\\begin{figure}[h]") > cat("\\centering") > cat("\\multido{\i=1+1}{7}{\includegraphics[page=\i,width=1.5i

Re: [R] Intersection of two sets of intervals

2009-04-15 Thread William Dunlap
The pmin/pmax approach fails if an open interval in the first list intersects with more than one open interval in the second. You can deal with that by a sorting trick that gives you the number of intervals each time point is in and then selecting the time points when the number of intervals cover

Re: [R] Intersection of two sets of intervals

2009-04-15 Thread Thomas Meyer
That does it perfectly -- and it's pretty much the same technique as used in the intervals pkg. -tom On 4/15/2009 12:43 PM, jim holtman wrote: Here is one way to find the overlaps: l1 <- rbind(c(1,3), c(5,10), c(13,24)) l2 <- rbind(c(2,4), c(7,14), c(20,30)) l1 [,1] [,2] [1,]13

Re: [R] How to apply a function to all combinations of the values of 2 or more variables?

2009-04-15 Thread Mike Lawrence
Check out plyr: http://had.co.nz/plyr/ On Wed, Apr 15, 2009 at 2:03 PM, Lane, Jim wrote: > Hi, All > > Forgive me if this is a stupid newbie question. I'm having no luck > googling an answer to this, probably because I don't know the right R > terminology to frame my question. I want to know how

Re: [R] How to apply a function to all combinations of the values of 2 or more variables?

2009-04-15 Thread baptiste auguie
I think you want to have a look at the plyr or doBy packages. It would be easier to give a precise answer with a minimal example. HTH, baptiste On 15 Apr 2009, at 18:03, Lane, Jim wrote: Hi, All Forgive me if this is a stupid newbie question. I'm having no luck googling an answer to this, p

Re: [R] Kruskal's MDS results

2009-04-15 Thread Dieter Vanderelst
Hi Michael, Thanks for the reply. I understand that the stress is a measure of how good the algorithm managed to represent the ordinal distances between items. And I also see why it's dependent on the number of dimensions. I was hoping someone could tell me exactly what the formula for the pe

Re: [R] Fedora 10 KDE plasma font rendering issue

2009-04-15 Thread Stefan Grosse
On Tue, 31 Mar 2009 13:02:23 -0700 (PDT) dfermin wrote: D> Has anyone else got this problem? If so do you have a work around or D> a solution? D> D> I'm using R version 2.8.1 installed from the Fedora 10 repositories D> if that helps. I have Fedora 10 and R 2.8.1 as well and have no problems. O

[R] How to apply a function to all combinations of the values of 2 or more variables?

2009-04-15 Thread Lane, Jim
Hi, All Forgive me if this is a stupid newbie question. I'm having no luck googling an answer to this, probably because I don't know the right R terminology to frame my question. I want to know how to run an R function on each combination of the values of 2 or more variables. In SAS-speak this is

Re: [R] Controlling widths in write.fwf()

2009-04-15 Thread Duncan Murdoch
On 4/15/2009 11:45 AM, Vemuri, Aparna wrote: Duncan I tried writeLines. But I need to print about 23 lines and it is really slow. This took about 1 second here: writeLines(as.character(1:23), "C:/temp/test.txt") I can't see how to make it much faster than that. Duncan Murdoch Tha

Re: [R] Intersection of two sets of intervals

2009-04-15 Thread jim holtman
Here is one way to find the overlaps: > l1 <- rbind(c(1,3), c(5,10), c(13,24)) > l2 <- rbind(c(2,4), c(7,14), c(20,30)) > l1 [,1] [,2] [1,]13 [2,]5 10 [3,] 13 24 > l2 [,1] [,2] [1,]24 [2,]7 14 [3,] 20 30 > # create matrix for overlaps > start <- cbind(

Re: [R] Survreg and censored observations

2009-04-15 Thread Frank E Harrell Jr
David S. Schwarz wrote: How does one indicate that a particular survival time is right censored in the Survreg routine? Read the documentation? :-) -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt Universit

[R] clustering, don't understand this error

2009-04-15 Thread Ana M Aparicio Carrasco
Hello, I am using the dunn metric, but something is wrong and I dont understand what or what that this error mean. Please can you help me with this? The instructions are: #Indice de Dunn disbupa=dist(bupa[,1:6]) a=hclust(disbupa) cluster.stats(disbupa,a,bupa[,7])$dunn And the error is: Erro

Re: [R] Forcing the extrapolation of loess through the origin

2009-04-15 Thread Charles C. Berry
On Tue, 14 Apr 2009, jimm-pa...@gmx.de wrote: Hi all, I'm fitting a line to my dataset. Later I want to predict missing values that exceed the [min,max] interval of my empirical data, therefore I choose surface="direct" for extrapolation. l1<-loess(y1~x1,span=0.1,data.frame(x=x1,y=y1),contro

Re: [R] Intersection of two sets of intervals

2009-04-15 Thread Thomas Meyer
Stavros, you are quite correct -- I discovered that the hard way a little while ago when testing my two-line solution. Use of pmin/pmax don't handle, for instance, cases where more than one interval in one set is wholly contained by an interval in the other. (I have a mis-posted msg awaiting mo

[R] Cross-Validation for Zero-Inflated Models

2009-04-15 Thread lara harrup (IAH-P)
Hi all I have developed a zero-inflated negative binomial model using the zeroinfl function from the pscl package, which I have carried out model selection based on AIC and have used likelihood ratio tests (lrtest from the lmtest package) to compare the nested models [My end model contains 2 fac

Re: [R] nls factor

2009-04-15 Thread Michael A. Miller
> "Manuel" == Manuel Morales writes: > nls(y ~ a[fac]*x^b, start=list(a=c(1,1), b=0.25)) Did you mean a[f]? nls(y ~ a[f]*x^b, start=list(a=c(1,1), b=0.25)) Mike __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-hel

[R] Lattice xyplot with text under x-axis

2009-04-15 Thread kate.m
Hi All, I have a data set which I need to plot and show the values of one of the variables as a second x-axis. library(lattice) year<-c(2001,2002,2003,2004,2005,2006) fac<-c("arts","arts","arts","sci","sci","sci") staff<-c(95,98,99,32,31,36) part<-c(32,31,33,15,16,14) df1<-data.frame(year

[R] False convergence error with lmer (package lme4) - What does it mean?

2009-04-15 Thread Peter H Singleton
Hello, I've run 7 candidate models using mixed-effects logistic regression with the lmer function from the lme4 package, and I'm getting the following error for 5 of those models: Warning message: In mer_finalize(ans : false convergence (8). The candidate models all run with the same data, just

Re: [R] Extending a vector to length n

2009-04-15 Thread Gabor Grothendieck
This may not be everything you would like but perhaps its sufficient: > structure("length<-"(a, 2), class = class(a)) [1] "2008-01-01" NA Your second example looks ok as is. Can't tell what you don't like about it. On Wed, Apr 15, 2009 at 10:55 AM, hadley wickham wrote: > In general, how can I

Re: [R] excluding a column from a data frame

2009-04-15 Thread Bert Gunter
How about: xx[,-match("x2",names(xx))] or xx[,names(xx) != "x2"] etc. Bert Gunter Genentech Nonclinical Biostatistics 650-467-7374 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Erin Hodgess Sent: Tuesday, April 14, 2009 10:

Re: [R] Controlling widths in write.fwf()

2009-04-15 Thread Vemuri, Aparna
Duncan I tried writeLines. But I need to print about 23 lines and it is really slow. Thanks Aparna -Original Message- From: Duncan Murdoch [mailto:murd...@stats.uwo.ca] Sent: Tuesday, April 14, 2009 4:34 PM To: Vemuri, Aparna Cc: r-help@r-project.org Subject: Re: [R] Controlling wi

Re: [R] issue with L-BFGS-B in optim (optim just hangs)

2009-04-15 Thread Ravi Varadhan
Hi Tiago, It is hard for me to speculate without knowing more about your problem. Here is what I would suggest, assuming your problem specification and its computer implementation are correct: (1) You may try to terminate the algorithm by specifying a different stopping criterion than the defa

Re: [R] data frame display

2009-04-15 Thread jim holtman
Also consider the "View" function for looking at the dataframe On Wed, Apr 15, 2009 at 10:13 AM, Vladan Arsenijevic wrote: > Hi all, > > I am dealing with a big data frame. When printing something like > >> allData[[3]] > > 1  625.364  38.223 21.014 0.216 1.241411    V 1050o 58.38065 -0.06178768

[R] Equivalent to Stata egen

2009-04-15 Thread Peter Kraglund Jacobsen
What are the R equivalents to the Stata command egen? egen temp = anycount(t0vas t30vas t60vas t120vas t240vas t360vas), values(0,1,2,3,4,5,6,7,8,9,10) egen temp2 = rowtotal(t0vas t30vas t60vas t120vas t240vas t360vas) __ R-help@r-project.org mailing li

Re: [R] Extending a vector to length n

2009-04-15 Thread Richard . Cotton
> In general, how can I increase a vector of length m (< n) to length n > by padding it with m - n missing values, without losing attributes? > The two approaches I've tried, using length<- and adding missings with > c, do not work in general: > > > a <- as.Date("2008-01-01") > > c(a, NA) > [1] "2

[R] AICs from lmer different with summary and anova

2009-04-15 Thread Jonathan Williams
Dear R Helpers, I have noticed that when I use lmer to analyse data, the summary function gives different values for the AIC, BIC and log-likelihood compared with the anova function. Here is a sample program #make some data set.seed(1); datx=data.frame(array(runif(720),c(240,3),dimnames=list(NUL

Re: [R] nls factor

2009-04-15 Thread Manuel Morales
Oops! I made a mistake. Corrected below. On Wed, 2009-04-15 at 11:05 -0400, Manuel Morales wrote: > A more compact way to code factors in nls is to use the syntax factor[]. > > Here's an example using a simplified version of Ravi's example: > > n <- 200 > set.seed(123) > x <- runif(n) > a <- gl(

[R] Survreg and censored observations

2009-04-15 Thread David S. Schwarz
How does one indicate that a particular survival time is right censored in the Survreg routine? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting gu

Re: [R] issue with L-BFGS-B in optim (optim just hangs)

2009-04-15 Thread Paul Smith
On Wed, Apr 15, 2009 at 3:57 PM, Tiago Marques wrote: > I am using optim, with method=L-BFGS-B, to maximize a likelihood inside a > large simulation exercise. This runs fine for most simulated data sets, but > for some reason, about 1 out of 100 times, optim will just hang. > Using a dumb approach

Re: [R] nls factor

2009-04-15 Thread Manuel Morales
A more compact way to code factors in nls is to use the syntax factor[]. Here's an example using a simplified version of Ravi's example: n <- 200 set.seed(123) x <- runif(n) a <- gl(n=2, k=n/2) # a two-level factor eps <- rnorm(n, sd=0.5) y <- as.numeric(a) * x^.5 + eps nls(y ~ a[]*x^b, start=l

Re: [R] Decomposition of time series with forecast package

2009-04-15 Thread bogaso.christofer
If I am right then you must get the seasonal factor etc (if any) out before fitting ant ARIMA (or statistical model) i.e. fit ARIMA on residual series not original series. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of djhurio Sent:

Re: [R] using Sweave, how to save a plot in a given size

2009-04-15 Thread Lore M
I just want to add that I didn't have any overful box before I use : <>= pdf("fig1.pdf", width = wid, heigth = hei) plot(1:10) plot(1:10) dev.off() cat("\\begin{figure}[h]") cat("\\centering") cat("\\multido{\i=1+1}{7}{\includegraphics[page=\i,width=1.5in, height = 1.5in]{images.pdf}}") cat("\

[R] issue with L-BFGS-B in optim (optim just hangs)

2009-04-15 Thread Tiago Marques
Dear R-Help List, I am using optim, with method=L-BFGS-B, to maximize a likelihood inside a large simulation exercise. This runs fine for most simulated data sets, but for some reason, about 1 out of 100 times, optim will just hang. Using a dumb approach to the problem (i.e. printing the parame

Re: [R] using Sweave, how to save a plot in a given size

2009-04-15 Thread Lore M
You're right, I'm sorry to disturb you with my Latex problem. If anyone has an idea, here is the Latex code that I get : \begin{figure} \multido{\i=1+1}{7}{\includegraphics[page=\i,width=1.5in, height = 1.5in]{image.pdf} \\ } \end{figure} I tried to break the line with "\\" or with "\linebrea

[R] Extending a vector to length n

2009-04-15 Thread hadley wickham
In general, how can I increase a vector of length m (< n) to length n by padding it with m - n missing values, without losing attributes? The two approaches I've tried, using length<- and adding missings with c, do not work in general: > a <- as.Date("2008-01-01") > c(a, NA) [1] "2008-01-01" NA >

[R] GEEs - custom link functions

2009-04-15 Thread Mark Edmondson-Jones
Dear All, Is it possible to run a GEE analysis with a custom link function in R? In particular I'm wanting to use a mafc.logit() generated link function (using the package psyphy). I can use this with a GLM, but it looks like the gee package only accepts predefined link functions. Thanks, Mark

Re: [R] Intersection of two sets of intervals

2009-04-15 Thread Thomas Meyer
pmax/pmin did the trick nicely -- the right-size tool I was hoping for. Thanks to all, -tom On 4/15/2009 9:14 AM, ONKELINX, Thierry wrote: Not of the self but still not complicated: list1 <- data.frame(open=c(1,5), close=c(2,10)) list2 <- data.frame(open=c(1.5,3), close=c(2.5,10)) Intersec <

Re: [R] using Sweave, how to save a plot in a given size

2009-04-15 Thread ONKELINX, Thierry
This seems more a LaTeX problem than an R problem. But can you provide us (an sample example of) the LaTeX code the yields the overfull box. ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Instit

[R] labcon(adehabitat) & large number of patches

2009-04-15 Thread milton ruser
Dear all, I have about 20,000 binary images, on the sense of habitat / non-habitat. I am running labcon() on these images (512x512pix), but when the number of "patches" is very large, the labcon stop, without error, and never end. I am running on a Linux machine, with 6Gb ram (memory is not proble

Re: [R] How to Reshuffle a distance object

2009-04-15 Thread Sarah Goslee
You don't say what your intent is, but for most applications it's important to preserve the pairwise matches. Here's one way to do that. library(ecodist) # for the convenient functions lower() and full() library(ade4) x1 <- c(rep(0,4),1) x2 <- c(rep(0,2),rep(1,3)) x3 <- c(rep(1,3), rep(0,2)) X <-

Re: [R] performing function on data frame

2009-04-15 Thread David Hajage
Hi Karin, I'm not sure I understand... Is this what you want ? d$y - mean(d$y)/sd(d$y) 2009/4/15 Karin Lagesen > > Hi! > > First, pardon me if this is a faq. I think I should be using some sort > of apply, but I am not managing to figure those out. > > I have a data frame similar to this: > >

Re: [R] nls factor

2009-04-15 Thread Ravi Varadhan
Hi, Here is one-way to do it (the following code shows a simulation example): n <- 200 set.seed(123) x <- runif(n) f <- gl(n=2, k=n/2) # a two-level factor x1 <- x * (f == 1) x2 <- x * (f == 2) a <- c(rep(2, n/2), rep(5, n/2)) b <- 0.5 nsim <- 100 nls.coef <- matrix(NA, nsim, 3) for (i

[R] shift/lag when merge zoo

2009-04-15 Thread j.k
Hello alltogheter, I have a little problem regarding merging to zoo series. I want to merge two zoo series to reduce the timegaps between the stamps. I use the following code: data.test <- as.POSIXct(seq(data.input01[1,1],data.input01[nrow(data.input01),1],900),tz="GMT") data.troughput01 <- as.zo

Re: [R] data frame display

2009-04-15 Thread ONKELINX, Thierry
Have a look at the width argument in ?options HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Sectio

[R] performing function on data frame

2009-04-15 Thread Karin Lagesen
Hi! First, pardon me if this is a faq. I think I should be using some sort of apply, but I am not managing to figure those out. I have a data frame similar to this: > d <- data.frame(x = LETTERS[1:5], y = rnorm(5), z = rnorm(5)) > d x y z 1 A 0.1605464 -0.2719820 2 B -0.925

Re: [R] Creating a graphics window (in Windows, with RGui) that is not constrained to the RGui Window

2009-04-15 Thread Joseph Voelkel
Thanks, Uwe. This is exactly what I wanted. Joe -Original Message- From: Uwe Ligges [mailto:lig...@statistik.tu-dortmund.de] Sent: Wednesday, April 15, 2009 3:42 AM To: Joseph Voelkel Cc: r-help@r-project.org Subject: Re: [R] Creating a graphics window (in Windows,with RGui) that is not

[R] data frame display

2009-04-15 Thread Vladan Arsenijevic
Hi all, I am dealing with a big data frame. When printing something like allData[[3]] 1 625.364 38.223 21.014 0.216 1.241411V 1050o 58.38065 -0.06178768 2 383.709 55.811 21.435 0.296 1.241411V 1050o 58.38308 -0.03328282 3 434.669 58.597 21.207 0.233 1.241411V 1050o 58.38334

[R] How to Reshuffle a distance object

2009-04-15 Thread Dale Steele
I would like to randomly shuffle a distance object, such as the one created by ade4{dist.binary} below. My first attempt, using sample(jc.dist) creates a shuffled vector, losing the lower triangular structure of the distance object. How can I Ishuffle the lower triangular part of a distance matrix

Re: [R] Kruskal's MDS results

2009-04-15 Thread Michael Denslow
Hi Dieter, I'll take a shot at this. As I understand it, the stress is telling you how the ordination distances compare with original dissimilarities that you calculated. It is a measure how well your ordination has done in representing the relationship of your sites. Note that the stress will

Re: [R] using Sweave, how to save a plot in a given size

2009-04-15 Thread Lore M
After few corrections, it does work. But I have several plots to include in my document and, because of those commands, they're all on the same line even if there are 20 plots. I mean that Latex doesn't car about textwidth anymore and I get an overfull box (too wide). What could I do to correct

Re: [R] nls factor

2009-04-15 Thread Paul Smith
On Wed, Apr 15, 2009 at 2:33 PM, Paul Smith wrote: > On Wed, Apr 15, 2009 at 1:27 PM, Manuel Gutierrez > wrote: >> I want to fit the model y=a*x^b using nls; where "a" should be different for >> each level of a factor. >> What is the easiest way to fit it? Can i do it with nls? >> I've looked the

Re: [R] Intersection of two sets of intervals

2009-04-15 Thread Stavros Macrakis
There is a very nice "intervals" package in CRAN. It is impressively efficient even for intersections of many millions of intervals. If I remember correctly, it is purely in-core, so on a 32-bit R you'll be limited to something like 100 million intervals. Is that enough for your application?

Re: [R] nls factor

2009-04-15 Thread Paul Smith
On Wed, Apr 15, 2009 at 1:27 PM, Manuel Gutierrez wrote: > I want to fit the model y=a*x^b using nls; where "a" should be different for > each level of a factor. > What is the easiest way to fit it? Can i do it with nls? > I've looked the help pages and the MASS example in page 249 but the formula

Re: [R] Intersection of two sets of intervals

2009-04-15 Thread ONKELINX, Thierry
Not of the self but still not complicated: list1 <- data.frame(open=c(1,5), close=c(2,10)) list2 <- data.frame(open=c(1.5,3), close=c(2.5,10)) Intersec <- data.frame(Open = pmax(list1$open, list2$open), Close = pmin(list1$close, list2$close)) Intersec[Intersec$Open > Intersec$Close, ] <- NA Inter

Re: [R] Intersection of two sets of intervals

2009-04-15 Thread Dimitris Rizopoulos
one way is: list1 <- as.data.frame(list(open=c(1,5), close=c(2,10))) list2 <- as.data.frame(list(open=c(1.5,3), close=c(2.5,10))) data.frame( open = pmax(list1$open, list2$open), close = pmin(list1$close, list2$close) ) I hope it helps. Best, Dimitris Thomas Meyer wrote: Hi, Algor

Re: [R] Intersection of two sets of intervals

2009-04-15 Thread Duncan Murdoch
On 4/15/2009 8:59 AM, Thomas Meyer wrote: Hi, Algorithm question: I have two sets of "intervals", where an interval is an ordered pair [a,b] of two numbers. Is there an efficient way in R to generate the intersection of two lists of same? For concreteness: I'm representing a set of intervals

  1   2   >