[R] problem with NA and if

2008-07-04 Thread Keld Jørn Simonsen
Hi I would like to sum a number of time series, some of them having NA's Standard action is here that if I sum a value with a NA, then the result is NA. I would like it to just keep the value. I then try to: a = NA; if (a == NA) { a = 0} just to try it out, but it says Error in if (a ==

Re: [R] Recoding

2008-07-04 Thread Agustin Lobo
Thanks. This is a simple and efficient solution for the case in which the elements of the vector values are integers (which is often the case as in the example that came to my mind). Nevertheless, let me suggest having a more comprehensive function recode in base, as this is a very usual and

Re: [R] problem with NA and if

2008-07-04 Thread Andrew Robinson
Hi Keld you should read ?sum. sum(c(1,2,NA), na.rm=TRUE) Cheers Andrew On Fri, Jul 04, 2008 at 08:29:34AM +0200, Keld J?rn Simonsen wrote: Hi I would like to sum a number of time series, some of them having NA's Standard action is here that if I sum a value with a NA, then the result

Re: [R] problem with NA and if

2008-07-04 Thread Bill.Venables
This is an old one. NA is not a real value, but a marker of something missing. Hence the expression a == NA is really an incomplete expression (the right hand side of the equality is missing) and hence cannot be evaluated. Hence the error message. This is why the function is.na() exists,

Re: [R] problem with NA and if

2008-07-04 Thread Albert Greinoecker
try is.na() regards, Albert Am Freitag, den 04.07.2008, 08:29 +0200 schrieb Keld Jørn Simonsen: Hi I would like to sum a number of time series, some of them having NA's Standard action is here that if I sum a value with a NA, then the result is NA. I would like it to just keep the

[R] kriging problem(?)

2008-07-04 Thread robert . ptacnik
Hei, I have two spatial datasets Sa and Sb, both with lat-lon coordinates and from same geographic area, but from different localities within the area (independent samples). Sa is biotoc data, Sb is some environmental parameter (fertility). I 'know' that Sb affects Sa, but wonder on which scale. I

[R] Problem in installing Biobase

2008-07-04 Thread Jason Lee
Hi, Recently I try to install Biobase component using the tutorials from cran.r-project.org/doc/Rnews/Rnews_2006-5.pdf I tried u - http://bioconductor.org/biocLite.R; source(u) biocLite(pkgDepTools, dependencies=TRUE) Running biocinstall version 2.0.8 with R version 2.5.1 Your version of R

Re: [R] apply with a division

2008-07-04 Thread Gavin Simpson
[Sorry, I seem to have misplaced the original posting, hence I'll reply here as I haven't seen this solution mentioned yet] See ?sweep - this is very general function for this sort of operation. Note that mat is the OP's data as a matrix, not a data frame. This doesn't work if mat is a data

Re: [R] Problem in installing Biobase

2008-07-04 Thread Prof Brian Ripley
On Fri, 4 Jul 2008, Jason Lee wrote: Hi, Recently I try to install Biobase component using the tutorials from cran.r-project.org/doc/Rnews/Rnews_2006-5.pdf I tried u - http://bioconductor.org/biocLite.R; source(u) biocLite(pkgDepTools, dependencies=TRUE) Running biocinstall version 2.0.8

Re: [R] kriging problem(?)

2008-07-04 Thread Paul Hiemstra
Hi Robert, A package I use for spatial statistics is gstat. It supports a method called co-kriging that seems to fit your needs. To get a good overview of the spatial capabilities of R a good place to start is the Spatial Task View (http://cran.r-project.org/web/views/Spatial.html). If you

Re: [R] Exporting a Graph that has lines()

2008-07-04 Thread Peter Dalgaard
R_Learner wrote: You guys are completely right...my lines were off the graph. I was also using points() in addition to lines, so it seems like it needs a pre-specified range unlike plot(). Yes. Or more precisely: plot() is not prescient, it will scale to contain its own points/lines, but not

[R] passing arguments to a R script

2008-07-04 Thread Daren Tan
I would like to pass several arguments to a R script. How can I do that ? R test.R arg1 arg2 arg3 _ Easily edit your photos like a pro with Photo Gallery. [[alternative HTML version deleted]]

[R] Hmisc latex: table column width

2008-07-04 Thread Lauri Nikkinen
R users, I'm trying to set a column width to one of the columns in a latex table (using Hsmic package, latex function). My intention is to get \begin{tabular}{lp{1.2in}ll}\hline\hline Here's an example ### R code # DF - data.frame(Titanic) DF$long - paste(This is a

[R] stop without error message

2008-07-04 Thread Eric Ferreira
Dear useRs How can I stop a loop without printing the 'error' message (givin by stop() , for instance) ? Best regards, -- Eric B Ferreira Departamento de Ciências Exatas Universidade Federal de Lavras Minas Gerais - Brasil [[alternative HTML version deleted]]

Re: [R] problem with NA and if

2008-07-04 Thread Keld J?rn Simonsen
On Fri, Jul 04, 2008 at 04:44:53PM +1000, Andrew Robinson wrote: Hi Keld you should read ?sum. sum(c(1,2,NA), na.rm=TRUE) Thanks, that solved my problem. Best regars keld Cheers Andrew On Fri, Jul 04, 2008 at 08:29:34AM +0200, Keld J?rn Simonsen wrote: Hi I would like to

Re: [R] Problem with strucchange package

2008-07-04 Thread tolga . i . uzuner
Hi Achim, First of all, thanks for the strucchange package. It's very useful. Looking forward to the zoo changes. Tolga Achim Zeileis [EMAIL PROTECTED] 02/07/2008 20:56 To [EMAIL PROTECTED] cc r-help@r-project.org Subject Re: [R] Problem with strucchange package On Wed, 2 Jul 2008,

Re: [R] stop without error message

2008-07-04 Thread Duncan Murdoch
On 7/4/2008 8:04 AM, Eric Ferreira wrote: Dear useRs How can I stop a loop without printing the 'error' message (givin by stop() , for instance) ? Just put in a break statement, e.g. for (i in 1:10) { + print(i) + if (i 5) break + } [1] 1 [1] 2 [1] 3 [1] 4 [1] 5 [1] 6 Duncan

[R] test for difference in variance

2008-07-04 Thread Anders Malmendal
I have two groups and want to test if the variances between subgroups are different in the two groups. For each group I have 5 subgroups with 5 replicates for each. Does anyone have an idea how I could do this without loosing the power from my 5 replicates? I am thankful for any help. Anders

[R] Repeated measures lme or anova

2008-07-04 Thread John Coulthard
Hi As I can't find an example of my data structure I'd like some advice on which is the most appropriate test for significant effects. If I should be using either lme or anova, is the relevant example below the best/correct way to do the test? The Data... 2 groups of patients (5 in GroupA,

[R] Test for multiple comparisons: Nonlinear model, autocorrelation?

2008-07-04 Thread J S
Dear R community, I have a nonlinear model describing average daily soil temperature. What test should I use to compare differences in soil temperature of the two studied vegetation types depending upon month? Building linear contrasts for the developed nonlinear model does not help since

[R] update search path for attached data

2008-07-04 Thread Ulrich Leopold
Dear list, is there a way of updating the search path when using attach() for a data set. I am overwriting a variable in a data frame. To update teh search path I do the follwoing: attach(dataset) some data manipulation of dataset detach(dataset) attach(dataset) # to update the search path

Re: [R] update search path for attached data

2008-07-04 Thread Prof Brian Ripley
On Fri, 4 Jul 2008, Ulrich Leopold wrote: Dear list, is there a way of updating the search path when using attach() for a data set. I am overwriting a variable in a data frame. To update teh search path I do the follwoing: attach(dataset) some data manipulation of dataset detach(dataset)

[R] Re ad in a file - produce independent vectors

2008-07-04 Thread jimineep
Is there a way of reading in a file in a way that each line becomes a vector: for example: meals.txt breakfastbaconeggssausage lunchsandwichapplemarsbarcrisps dinnerchickenricecustardpie I want to read in this file and end up with 3 different

Re: [R] Re ad in a file - produce independent vectors

2008-07-04 Thread Gabor Grothendieck
Just read them in as whole lines and then split them giving a list of vectors. See ?readLines and ?strsplit Lines - readLines(meat.txt) strsplit(Lines, +) This can also be done using strapply in gsubfn which extracts words rather than splitting on delimiters: library(gsubfn) strapply(Lines,

[R] Odp: Re ad in a file - produce independent vectors

2008-07-04 Thread Petr PIKAL
Hi [EMAIL PROTECTED] napsal dne 04.07.2008 16:38:08: Is there a way of reading in a file in a way that each line becomes a vector: for example: meals.txt breakfastbaconeggssausage lunchsandwichapplemarsbarcrisps dinnerchickenricecustardpie

Re: [R] Re ad in a file - produce independent vectors

2008-07-04 Thread Marc Schwartz
on 07/04/2008 09:38 AM jimineep wrote: Is there a way of reading in a file in a way that each line becomes a vector: for example: meals.txt breakfastbaconeggssausage lunchsandwichapplemarsbarcrisps dinnerchickenricecustardpie I want to read in this

Re: [R] Re ad in a file - produce independent vectors

2008-07-04 Thread Prof Brian Ripley
On Fri, 4 Jul 2008, jimineep wrote: Is there a way of reading in a file in a way that each line becomes a vector: for example: meals.txt breakfastbaconeggssausage lunchsandwichapplemarsbarcrisps dinnerchickenricecustardpie I want to read in this

[R] initialize a matrix

2008-07-04 Thread mysimbaa
-- View this message in context: http://www.nabble.com/initialize-a-matrix-tp18279886p18279886.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

[R] Calling and running a compiled program inside R

2008-07-04 Thread Paek, Insu
Hi, I need to use the outputs from a complied program (*.exe program that is made by some one else) for numerous data sets and use R with the outputs for some computations. I thought that it would be very efficient if I can use R from the beginning to the end by calling the exe program and

[R] create a zero matrix fill

2008-07-04 Thread mysimbaa
Dear R user, I have written a function which returns max,min and variation of a power (see below) Power is a given matrix(1,n) I call the function Variation-VAR(p,(n-deltat)) Now the problem is when I want plot(Results[1],Results[2]). Not possible! I become the following error (in english it

Re: [R] initialize a matrix

2008-07-04 Thread mysimbaa
I had implemented this tvar=pmean=pmin=pmax=varmax=varmin-matrix(data=NA,nrow=n-deltat-tml,ncol=1) Now the problem I become pmean=pmin=pmax which is not possible! Any suggestion? Thanks in advance -- View this message in context:

[R] RES: initialize a matrix

2008-07-04 Thread Leandro Marino
You have to put the tml in the function and deltat too. like VAR-function(power,length,deltat,tml){ -Mensagem original- De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] nome de mysimbaa Enviada em: sexta-feira, 4 de julho de 2008 11:22 Para: r-help@r-project.org Assunto: [R]

[R] RES: Error while plotting matrix

2008-07-04 Thread Leandro Marino
You aren't using a matrix. This is a vector so you can only use: tvar - rep(0,(length-tml0)) pmean - rep(0,(length-tml0)) pmin - rep(0,(length-tml0)) pmax - rep(0,(length-tml0)) varmax - rep(0,(length-tml0)) varmin - rep(0,(length-tml0)) Why are you not using an data frame? Do you have to

Re: [R] Calling and running a compiled program inside R

2008-07-04 Thread jim holtman
?system On Fri, Jul 4, 2008 at 11:18 AM, Paek, Insu [EMAIL PROTECTED] wrote: Hi, I need to use the outputs from a complied program (*.exe program that is made by some one else) for numerous data sets and use R with the outputs for some computations. I thought that it would be very

Re: [R] create a zero matrix fill

2008-07-04 Thread jim holtman
It would help if you follows the posting guide and provided commented, minimal, self-contained, reproducible code. You at least have to tell what the structure of Results is (str(Results)). It looks like a list and if you are trying to plot the index vs. the mean, you might try:

[R] logistic regreesion and score test

2008-07-04 Thread 刘杰
Hi guys, Here I have a dataset with 800 positive samples and 800 negative ones looking like this y x1 x2 1 0 1 -1 1 1 .. I want to build a logistic regression model with y as the dependent variable, x1 and x2 as the independent variables (logit(y)=b0+ b1*x1 +b2*x2.). Then I want to compare

Re: [R] logistic regreesion and score test

2008-07-04 Thread Frank E Harrell Jr
刘杰 wrote: Hi guys, Here I have a dataset with 800 positive samples and 800 negative ones looking like this y x1 x2 1 0 1 -1 1 1 .. I want to build a logistic regression model with y as the dependent variable, x1 and x2 as the independent variables (logit(y)=b0+ b1*x1 +b2*x2.). Then I want

[R] synthax for R CMD INSTALL

2008-07-04 Thread Naiara Pinto
Dear all, I am trying to install rgdal from source on a Mac OS 10.4.11. I installed GDAL and PROJ as frameworks so the installation does not work unless I explicitly state where the GDAL and PROJ libraries are. I tried: R CMD INSTALL rgdal_0.5-25

Re: [R] Test for multiple comparisons: Nonlinear model, autocorrelation?

2008-07-04 Thread Spencer Graves
The question seems too general for me to offer specific suggestions. What problem are you trying to solve that you think 'multiple comparisons' will answer? Can you produce a similar problem that is completely self-contained example that eliminates complexity that may not be needed to

[R] p-value for Nonmetric Multidimentional Scaling?

2008-07-04 Thread Michael Denslow
Dear R-helpers, I am running metaMDS in the vegan package, which uses isoMDS in MASS, to perform Nonmetric Multidimentional Scaling (NMDS). I have seen some authors report a p-value for the NMDS ordination based on randomization of the dataset. As I understand it this is meant to compare the

Re: [R] p-value for Nonmetric Multidimentional Scaling?

2008-07-04 Thread Bill.Venables
You need to ask yourself a number of questions, e.g. What is the hypothesis you wish to test? What is the test statistic you wish to use to test it? How can I get some information on where my value of that statistic sits with respect to its null hypothesis distribution? p-values do not exist