[R] subset and or operator

2009-03-23 Thread lauramorg...@bluewin.ch
Hello, I'm trying to subset a dataframe where I have many observation taken in different years. I would like to subset the dataframe (in this example called table) to get a new dataframe containing only the observation of year 1995, 1998 and 2000. I've tried to use subset and the or operator |

Re: [R] mean over previous cells

2009-02-20 Thread lauramorg...@bluewin.ch
If, suppose, the name of your dataframe is dataframe , you could try something like: mean60days-c() for(i in 1:length(dataframe$SST)) + { + mean60days[[i]]-mean(dataframe$SST[i-10:i]) + } I'm not really sure it will work... my skills aren't that great... Anyway, it worked on a sample I tried it

Re: [R] mean over previous cells

2009-02-20 Thread lauramorg...@bluewin.ch
Sorry, I meant: If, suppose, the name of your dataframe is dataframe , you could try something like: mean60days-c() for(i in 1:length(dataframe$SST)) + { + mean60days[[i]]-mean(dataframe$SST[i-60:i]) + } I'm not really sure it will work... my skills aren't that great... Anyway, it worked on a

Re: [R] write.table

2009-02-20 Thread lauramorg...@bluewin.ch
Sorry, I'm using R 2.8.1 on Microsoft Windows XP professional 2002 Service Pack 2. The error I get is Error in write.table(x, file, nrow(x), p, rnames, sep, eol, na, dec, as.integer(quote), : 'list' type not implemented in 'EncodeElement' The problem is that I can' t manage to save the

Re: [R] write.table

2009-02-20 Thread lauramorg...@bluewin.ch
wrong? Messaggio originale Da: rip...@stats.ox.ac.uk Data: 20.02.2009 12.40 A: lauramorg...@bluewin.chlauramorg...@bluewin.ch Copia: r-help@r-project.org Oggetto: Re: [R] write.table On Fri, 20 Feb 2009, lauramorg...@bluewin.ch wrote: Sorry, I'm using R 2.8.1 on Microsoft Windows XP

Re: [R] write.table

2009-02-20 Thread lauramorg...@bluewin.ch
Thank you!!! unlist() worked perfectly!!! Have a nice weekend Laura Messaggio originale Da: petr.pi...@precheza.cz Data: 20.02.2009 14.58 A: lauramorg...@bluewin.ch Copia: r-help@r-project.org Oggetto: Re: [R] write.table Hi r-help-boun...@r-project.org napsal dne 20.02.2009 12:54:41

Re: [R] read.table : how to condition on error while opening file?

2009-02-19 Thread lauramorg...@bluewin.ch
Hello Stephane, here is something you could try, filelist - c(file1.txt, file2.txt, file3.txt) for (i in 1:3) { tmpList-try(read.table(filelist[[i]]), silent=TRUE) if(inherits(tmpList, try-error)) {print(paste(error opening file , filelist[[i]])) } else {

[R] write.table

2009-02-19 Thread lauramorg...@bluewin.ch
Hello, I tried to turn lists into vectors and then bind them together in order to create a dataframe but if, after this, I try to use the function write.table I get the following error message: Error in write.table(x, file, nrow(x), p, rnames, sep, eol, na, dec, as.integer(quote), : 'list'

Re: [R] summary of a list

2009-02-13 Thread lauramorg...@bluewin.ch
Hello Dieter and everyone, Thank you for your advice... but I didn't manage to solve my problem... :-( I actually like the fact that R tells me which ones of my regressions didn't achieve convergence and gives me a warning saying that there was a false or singular convergence... the problem is

[R] odfWeave prettyR

2009-02-13 Thread lauramorg...@bluewin.ch
Hello, I've been trying to use odfWeave and prettyR packages to create documents with both text and graphs, but so far I haven't been very lucky... With the function R2html () in prettyR package, when I try to use a source file, which works perfectly if I run it directly form R using

Re: [R] plotting the result of a nonlinear regression

2009-02-12 Thread lauramorg...@bluewin.ch
, main=print(formList[[i]]), sub=print(summary(resultList[[i]])$sigma)) lines(seqQ, predict(resultList[[i]], list(Portata = seqQ))) dev.off() } Messaggio originale Da: ssef...@gmail.com Data: 10.02.2009 18.15 A: lauramorg...@bluewin.ch Copia: r-help@r-project.org Oggetto: Re: [R

[R] plotting the result of a nonlinear regression

2009-02-10 Thread lauramorg...@bluewin.ch
Hello, to plot the result of a singular non linear regression (using nls) I usually use the function plotfit, for example: r.PTG.V-nls(PTG.P~ fz1(Portata, a,b), data=dati, start=list(a=10, b=10), nls.control(maxiter=200), algorithm='port', trace=TRUE, na.action=na.omit, lower=list(a=0, b=10),

[R] summary of a list

2009-02-10 Thread lauramorg...@bluewin.ch
Hello, I'm using the following for loop to find regression curves using a list of functions (formList), a list of starting values (startList), uppervalues (upperList) and lower values (lowerList). A sample of the list of function I use in the loop is the following: FormList - list(PTG.P ~

Re: [R] non linear regression with nls

2009-02-06 Thread lauramorg...@bluewin.ch
Thank you! It worked perfectly, also for the other variables! Messaggio originale Da: r...@life.ku.dk Data: 06.02.2009 13.29 A: lauramorg...@bluewin.ch Oggetto: Re: [R] non linear regression with nls Hi Laura, I think you have to make a list formulas: formList - list(NT.N ~ fz1

Re: [R] non linear regression with nls

2009-02-05 Thread lauramorg...@bluewin.ch
A: lauramorg...@bluewin.ch Oggetto: Re: [R] non linear regression with nls Hi Laura, I've the following suggestion for you using several lists and a for loop: fz1-function(Portata, a, b){a+b/Portata} fz2-function(Portata, a, b){a*exp(b*Portata)} fz3-function(Portata, a, b, d, e){a+b/Portata+d*(Portata^e

Re: [R] non linear regression with nls

2009-02-05 Thread lauramorg...@bluewin.ch
can someone specify the groups/subset? Thanks a lot! Laura Messaggio originale Da: kfr...@wisc.edu Data: 03.02.2009 15.36 A: lauramorg...@bluewin.ch Oggetto: Re: [R] non linear regression with nls Hi, Laura- You might have a look at ?nlsList(). Ken - Original Message - From

[R] non linear regression with nls

2009-02-03 Thread lauramorg...@bluewin.ch
Hello, I'm a beginner with R and it's the first time I'm using the R-help list... I hope I'm in the right place, if not: Sorry!! I need to do non linear regressions on a data set which columns are: river.namePortata PTG.P PO4.P NT.NNH4.N NO3.N BOD5SiO2 I need to predict