[R] question regarding time series packages

2007-11-19 Thread eugen pircalabelu
Good afternoon! I'm trying to learn time series but i have a bit of of a problem using R packages for this. 1. LakeHuron sample(500:600, 98) sample(500:600, 98)-t fit-arima(LakeHuron, order=c(2,1,1), xreg=t) fit predict(fit, n.ahead=1, newxreg=t) Now, my problem is this: is it ok to use

Re: [R] many zeroes in rgamma ... what's going on?

2007-11-19 Thread Prof Brian Ripley
On Sun, 18 Nov 2007, Gregory Gentlemen wrote: Dear Dr. Dalgaard, Thank you for your insight! In fact, I did read the example documentation, however, it pretty much told me the same thing that my little simulation did: there is ALOT of point mass at zero. Is there any fix to this problem?

Re: [R] Extracting only one part of an string

2007-11-19 Thread Prof Brian Ripley
On Mon, 19 Nov 2007, Benilton Carvalho wrote: I'd use: sapply(strsplit(Names, -), [[, 1) An alternative is sub(([^-]*).*, \\1, Names) which for many Names would be considerably more efficient. On Nov 19, 2007, at 2:14 AM, Tom.O wrote: Hi I wonder if there's a smarter way to do this

[R] ks.test

2007-11-19 Thread elyakhlifi mustapha
Hello, I want to do a normality test to know if donnees is defined as a normal distribution. To do that I can use the ks.test() function but I can't understand the results. I writed that: ks.test(donnees,pnorm,mean(donnees),sd(donnees)) and the results are: One-sample

[R] Reg : using two different matrix : how to do t.test

2007-11-19 Thread sata pinal
I have two matrix with same dimensions. I want to do t.test using each column from 2 different matrix. Row n Column names in both matrix are same. e.g. Matrix1 id VC1 VC2 VC3 R 1 2 3 R1 4 5 6 R3 7 8 9 Matrix2 id VC1 VC2 VC3 R 10 11 12 R1 13 14 15 R3 16

[R] Odp: Reg : using two different matrix : how to do t.test

2007-11-19 Thread Petr PIKAL
Hi [EMAIL PROTECTED] napsal dne 19.11.2007 09:32:25: I have two matrix with same dimensions. I want to do t.test using each column from 2 different matrix. Row n Column names in both matrix are same. e.g. Matrix1 id VC1 VC2 VC3 R 1 2 3 R1 4 5 6 R3 7 8 9 Matrix2 id VC1

Re: [R] R det

2007-11-19 Thread Robin Hankin
Hello Kalin det() does not take a complex matrix as an argument. To get the determinant of a complex matrix, use eigen(): mydet - function(a){prod(eigen(a,only.values=TRUE)$values)} a - matrix(1:9,3,3) a[1,1] - 1i mydet(a) [List: can we not add the above, or something like it, to the

Re: [R] R and reading matlab compressed files

2007-11-19 Thread Hans W Borchers
Prof Leslie Smith lss at cs.stir.ac.uk writes: Is there any way to read these files (standard .mat files, created by matlab version 7 onwards are compressed)? I know that R.matlab doesn't read them (it even says in the file MatlabServer.m Matlab v7 saves compressed files, which is not

[R] using two different matrix : how to do t.test

2007-11-19 Thread mogra
I have two matrix with same dimensions. I want to do t.test using each column from 2 different matrix. Column names in both matrix are same. e.g. Matrix1 id VC1 VC2 VC3 R 1 2 3 R1

Re: [R] many zeroes in rgamma ... what's going on?

2007-11-19 Thread Peter Dalgaard
Prof Brian Ripley wrote: On Sun, 18 Nov 2007, Gregory Gentlemen wrote: Dear Dr. Dalgaard, Thank you for your insight! In fact, I did read the example documentation, however, it pretty much told me the same thing that my little simulation did: there is ALOT of point mass at zero. Is there

[R] ave and levels

2007-11-19 Thread Patrick Hausmann
Dear list, I want to calculate the standard deviation using 'ave' on two different DFs. In the first DF M1 has only 1 level: str(x) 'data.frame': 18 obs. of 3 variables: $ M1: Factor w/ 1 level A03: 1 1 1 1 ... $ M2: num 2.76 2.93 3.06 3.07 3.12 ... $ M3: Factor w/ 2 levels

Re: [R] Editorial in Notices of the AMS: Open Source Mathematical Software

2007-11-19 Thread Gorden T Jemwa
This issue is also discussed in depth in the following article available at http://jmlr.csail.mit.edu/papers/v8/sonnenburg07a.html For those interested, while scanning /. tonight, I came across a posting which referred to a new editorial in the November 2007 Notices of the American

Re: [R] using two different matrix : how to do t.test

2007-11-19 Thread Henrique Dallazuanna
Perhaps you can try: In two matrix 3 x 3(see 'dim' argument): apply(array(data=c(mat1, mat2), dim=c(3,3,2)), 2, function(x)t.test(x[,1], x[,2])$p.value) On 19/11/2007, mogra [EMAIL PROTECTED] wrote: I have two matrix with same dimensions. I want to do t.test using each column from 2

Re: [R] building packages: hhc.exe not found using xp

2007-11-19 Thread Prof Brian Ripley
On Mon, 19 Nov 2007, Nicodemus, Kristin (NIH/NIMH) [C] wrote: Hello, Apologies in advance if this should be in R-devel, not Rhelp. I did read through the R-devel thread started by Gabor Grothendieck in September of this year - I am getting the exact same error using a new computer that

Re: [R] How do I import packages with the package I've built?

2007-11-19 Thread Nutter, Benjamin
So if I understand you correctly, if I include in my namespace file the commandimportFrom(MASS, stepAIC), whenever stepAIC is called from my package, it will still run even if I haven't explicitly imported the MASS package? Or if I use the command import(survival) then the functions

[R] Using density() and turnpoint to Identify maxima in data

2007-11-19 Thread Rainer M. Krug
Hi I have a large dataset which follows a multimodal distribution. And I would like to identify the maxima. As the data is obtained from a stochastic simulation, not all maxima in the data are real maxima of the dirstribution but rather small random fluctuations. Unfortunately, it is not

Re: [R] defining error families in lme?!

2007-11-19 Thread Ben Bolker
Tonker wrote: Hi I am trying to run an lme on count data. lme (fixed = lognobees ~ round + spray + dist + fenconcpoint + uncolt200mbuffer + daysafterspray + round:spray + round:fenconcpoint + spray:fenconcpoint + spray:uncolt200mbuffer + dist:uncolt200mbuffer +

[R] spatial overlap of datasets

2007-11-19 Thread uimbpv
Hi, I have two datasets for which I have used cmdscale (to scale them to for example 6 dimensions) and then I got their convex hulls. I need to check if the two convex hulls/areas enclosed by these overlap - would I be able to do that in R? Any ideas are appreciated! Thanks.

[R] All nonnegative integer solution

2007-11-19 Thread aminzoll
Dear all, Is there any method in R to find all possible nonnegative integer solutions to the linear equation with unit coefficients as follow: X1+X2+...+Xk=N Thank you, Amin Zollanvari __ R-help@r-project.org mailing list

Re: [R] All nonnegative integer solution

2007-11-19 Thread Robin Hankin
Hello Amin The partitions library does this. If N=4 and k=3: library(partitions) blockparts(rep(4,3),4) [1,] 4 3 2 1 0 3 2 1 0 2 1 0 1 0 0 [2,] 0 1 2 3 4 0 1 2 3 0 1 2 0 1 0 [3,] 0 0 0 0 0 1 1 1 1 2 2 2 3 3 4 The solutions are enumerated in the columns. HTH rksh On 19 Nov 2007,

Re: [R] spatial overlap of datasets

2007-11-19 Thread Barry Rowlingson
Barry Rowlingson wrote: If any of the points of A fall inside B or vice versa then the convex hulls overlap. Pah, I'm wrong. View this with a fixed-width font: 21 2 11 21 2 convex hull of 1 and 2 overlap, yet no points of either are inside the

Re: [R] Date and lattice

2007-11-19 Thread Dieter Menne
Petr PIKAL petr.pikal at precheza.cz writes: I just encountered a strange behaviour trying to plot lattice xyplot with dates on x axis xyplot(rnorm(10)~seq(as.Date(2000/1/1), by=month, length=10)|sample(1:2, 10, replace=T)) Warning message: is.na() applied to non-(list or vector)

[R] Finding proportion of observations that are outliers from the left tail of the normal distribution

2007-11-19 Thread Thomas Frööjd
Hi fellow users I have a new R problem i am hoping to get some pointers on. I have a dataset that is approximately normally distributed but with a fat left tail. I am interested in a good measurement on how much fatter the left tail is than can be expected from a normal distribution. One thing

[R] sequence of vectors

2007-11-19 Thread Marc Bernard
Dear All, I wonder if there is any R function to generate a sequence of vectors from existing ones. For example: x 1- c(1,2,3) x2 - c(4,5) x3 - c(6,7,8) The desired output is a list of all 3*2*3 = 18 possible combinations of elements of x1,x2 and x3. One element for example is

Re: [R] All nonnegative integer solution

2007-11-19 Thread Peter Dalgaard
Robin Hankin wrote: Hello Amin The partitions library does this. If N=4 and k=3: library(partitions) blockparts(rep(4,3),4) [1,] 4 3 2 1 0 3 2 1 0 2 1 0 1 0 0 [2,] 0 1 2 3 4 0 1 2 3 0 1 2 0 1 0 [3,] 0 0 0 0 0 1 1 1 1 2 2 2 3 3 4 The solutions are enumerated in the columns.

Re: [R] sequence of vectors

2007-11-19 Thread John Kane
?expand.grid should do what you want. --- Marc Bernard [EMAIL PROTECTED] wrote: Dear All, I wonder if there is any R function to generate a sequence of vectors from existing ones. For example: x 1- c(1,2,3) x2 - c(4,5) x3 - c(6,7,8) The desired output is a list of

[R] hypen in pdf

2007-11-19 Thread Roland Kaiser
Hi all! I consulted the help pages for postscript(). I noticed the execption for the - sign which is mapped to a minus glyph. How can I define a textstring that contains a hyphen (a short dash) and is applicable with strwidth(). Further I want to print it with postscript() Thanks for any

Re: [R] sequence of vectors

2007-11-19 Thread Dimitris Rizopoulos
try: expand.grid(x1, x2, x3) Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/

[R] print matrix content on plot

2007-11-19 Thread Monica Pisica
Hi, I saved as a matrix a summary of a PCA analysis and I've used barplot to plot the PCA variances. I would like to print on the same graphic the values of my matrix m1 - in other words the summary of my PCA analysis. I can do it very painstaking with text for each row and make sure that

[R] snow, MPI, comm

2007-11-19 Thread Markus Schmidberger
Hello R Users, Hello Luke, in makeMPICluster (library snow) you set a explicit variable comm - 1 Therefore using snow, it is not possible to start two (or more) different MPI Clusters from one R session. Can you put comm and intercomm to the default cluster options? Best regards Markus --

Re: [R] Date and lattice

2007-11-19 Thread Petr PIKAL
[EMAIL PROTECTED] napsal dne 19.11.2007 15:38:26: Petr PIKAL petr.pikal at precheza.cz writes: I just encountered a strange behaviour trying to plot lattice xyplot with dates on x axis xyplot(rnorm(10)~seq(as.Date(2000/1/1), by=month, length=10)|sample(1:2, 10, replace=T))

[R] R code for L-moment digram

2007-11-19 Thread amna khan
Dear Sir I am getting errors in using following R code for L-moment ratio diagram Help in this regard plotlmrdia - + function(lmr, + nopoints=FALSE, + nolines=FALSE, + nolimits=FALSE, + nogev=FALSE, + noglo=FALSE, + nogpa=FALSE, +

[R] FW: Editorial in Notices of the AMS: Open Source Mathematical Software

2007-11-19 Thread Izmirlian, Grant (NIH/NCI) [E]
Dear Marc: Thanks for pointing this out to me. Here is my reply, just sent. Hopefully the R-core, Bioconductor Core and all afficionados aren't too offended by it, and hopefully it gets published. [EMAIL

[R] Trying to get around R

2007-11-19 Thread Epselon
I have three problems I am trying to simulate, that I am having difficulty getting around with. Problem 1. I want to determine the 85 percentile (the x value for which the sum of probabilities becomes 0.85) of the following distributions (two binomials and a Poisson with rate Lmbda= np of the

Re: [R] R and reading matlab compressed files

2007-11-19 Thread Henrik Bengtsson
Hi. On 11/17/07, Prof Leslie Smith [EMAIL PROTECTED] wrote: Is there any way to read these files (standard .mat files, created by matlab version 7 onwards are compressed)? I know that R.matlab doesn't read them (it even says in the file MatlabServer.m Matlab v7 saves compressed files, which

[R] any measure for curvature

2007-11-19 Thread Wensui Liu
in statistics, is there a measure for curvature? how to detect and quantify the curvature between 2 variales instead of using visualization? thank you so much! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

[R] it looks like ...

2007-11-19 Thread Jan de Leeuw
in 2007 we will publish seven volumes of JSS (four of them special volumes). Volume 18 Spectroscopy and Chemometrics in R Volume 19 regular Volume 20 Psychometrics in R Volume 21 regular Volume 22 Ecology and Ecological Modeling in R Volume 23 is being started, it is a regular volume, and may

[R] ASCII character set and hyphen

2007-11-19 Thread Roland Kaiser
Hi all! I want to print a hyphen to a pdf() or postscript() device. As the documentaion of postscript says ASCII Character 45(-) is mapped to a minus sign (ASCII Character 95) by default. The advice given is to use \173 for a hyphen. But, the following code produces a curly brace instead of a

Re: [R] Problem in R 2.6.0 for windows ?

2007-11-19 Thread Dieter Menne
Caio Azevedo cnaberdl at gmail.com writes: When I try to save a plot in a PDF format, using R 2.6.0 for windows, it appears the following message Error: Invalid font type Warning messages: 1: font family not found in PostScript font database 2: font family not found in PostScript font

Re: [R] ASCII character set and hyphen

2007-11-19 Thread Prof Brian Ripley
On Mon, 19 Nov 2007, Roland Kaiser wrote: Hi all! To add to my previous posting I want to give some more deatils give a more precise I want to print a hyphen to a pdf() or postscript() device. As the documentaion of postscript says ASCII Character 45(-) is mapped to a minus sign (ASCII

Re: [R] sequence of vectors

2007-11-19 Thread Gregory Warnes
Well, this is a natural thing to program up using 3 nested 'for', loops. Alternatively, one could use something like: combn - function( ..., l=list(...) ) + { + lens - sapply( args, length) + ncomb - prod(lens) + retval - matrix(ncol=length(args), nrow=ncomb) + for(i in

Re: [R] alternative to logistic regression

2007-11-19 Thread Greg Snow
Why not try it out for yourself to see how much the predictions change: x - runif(100, -1, 1) p - exp(3*x)/(1+exp(3*x)) y - rbinom(100, 1, p) plot(x,p, xlim=c(-1,1), ylim=c(0,1), col='blue') points(x,y) xx - seq(-1,1, length=250) lines(xx, exp(3*xx)/(1+exp(3*xx)), col='blue') fit1 - glm( y ~ x,

Re: [R] Trying to get around R

2007-11-19 Thread Julian Burgos
Hello Epselon (if that is your name), This sounds like homework questions. From the R-help posting guide: Basic statistics and classroom homework: R-help is not intended for these. If you have a specific question on R coding, do ask it (and provide reproducible code). But you should not

Re: [R] Why is model.matrix creating 2 columns for boolean?

2007-11-19 Thread Ross Boylan
On Sat, 2007-11-17 at 09:51 -0800, Ben Bolker wrote: Ross Boylan wrote: I have a data frame reading that includes a logical variable OLT along with response variable Reading and predictor True (BOTH are numeric variables; it's True as in the true value). When I suppress the

[R] biplot

2007-11-19 Thread Weiwei Shi
Hi, I am wondering how to draw biplot with the same scales on both plots? For example, if the two plots have much different scales, generally the two x-y's are scaled so that the two plots are sitting in the center automatically. How to disable this? Thanks -- Weiwei Shi, Ph.D Research

Re: [R] analysis of large data set

2007-11-19 Thread Greg Snow
On behalf of those of us trapped in 32-bit windows worlds. Thanks to Brian and the others that work on the windows port of R for the great tool and for pushing the boundaries of microsoft. Know that your efforts are appreciated even if we don't say Thank You often enough. -- Gregory (Greg) L.

Re: [R] logrank test

2007-11-19 Thread Terry Therneau
The information below is not nearly enough information to work from. We need to know what the data look like! This could be a feature of the statistical test, the code, or the particular data set you have in hand. Terry Therneau --begin included message --- hie carried out a

[R] Convert from ppp to spp objects

2007-11-19 Thread Honey Giroday
Hi All! As a new useR, I am currently working in R 2.5.1 to produce Ripley's L (the linear version of Ripley's K) for a spatial point dataset (originally a ESRI shapefile). I have coerced the data to a ppp object (because I was originally using 'kest' in the spstat package to produced

Re: [R] print matrix content on plot

2007-11-19 Thread Greg Snow
The textplot function in the gplots package may be of help. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Monica Pisica Sent:

[R] reading graph metadata text from a file

2007-11-19 Thread Alexy Khrabrov
I'd like to produce graphs with titles, axis labels, and legend as parameters read from a separate text file. Moreover, I'd like to use the legend for a short summary of the data -- not necessarily for describing the line colors per se. How do we do this? Cheers, Alexy

Re: [R] Convert from ppp to spp objects

2007-11-19 Thread Rolf Turner
On 20/11/2007, at 9:00 AM, Honey Giroday wrote: Hi All! As a new useR, I am currently working in R 2.5.1 to produce Ripley's L (the linear version of Ripley's K) for a spatial point dataset (originally a ESRI shapefile). I have coerced the data to a ppp object (because I was

[R] delete a row in a matrix

2007-11-19 Thread Barb, Jennifer (NIH/CIT) [E]
Can anyone tell me how to delete a row in a matrix? I have searched around and couldn't find a straightforward way to do this. Thanks, any help will be greatly appreciated. Jennifer [[alternative HTML version deleted]] __

Re: [R] delete a row in a matrix

2007-11-19 Thread Benilton Carvalho
theMatrix = matrix(1:100, nc=5) theMatrixWithoutRow5 = theMatrix[-5,] b On Nov 19, 2007, at 3:35 PM, Barb, Jennifer (NIH/CIT) [E] wrote: Can anyone tell me how to delete a row in a matrix? I have searched around and couldn't find a straightforward way to do this. Thanks, any help will be

[R] Search for a usable pan manual

2007-11-19 Thread Matthias Bindernagel
Hello, I'm looking for a more descriptive manual/tutorial/paper for the pan package. The provided manual and example do not contain any useful hints how to specify a model with more than one variable and leaves several questions unanswered. This also applies to the referred paper Schafer:

[R] biocep project (R for the Web and the Virtual R Workbench)

2007-11-19 Thread Karim Chine
Dear all, I have been writing during last year at the European Bioinformatics Institute a general unified open source solution for R integration. This work is now available via this link: http://www.ebi.ac.uk/microarray-srv/frontendapp/ The different frameworks and tools of the biocep project

[R] Using windows() and jpeg()

2007-11-19 Thread Irina Burmenko
Hello, I have the following question, which I haven't been able to resolve after days of trying. I used to save my plots as jpegs using the savePlot command. However, that seems to result in lost resolution. So now I'm trying to use the jpeg( ) function, but am having trouble because it

Re: [R] Search for a usable pan manual

2007-11-19 Thread markleeds
From: Matthias Bindernagel [EMAIL PROTECTED] Date: 2007/11/19 Mon PM 02:11:45 CST To: r-help@r-project.org Subject: [R] Search for a usable pan manual Joe Schafer wrote a text on missing data, the title of which escapes me and I can't say if it will be useful for your particular problem. My

Re: [R] Search for a usable pan manual

2007-11-19 Thread markleeds
From: Matthias Bindernagel [EMAIL PROTECTED] Date: 2007/11/19 Mon PM 02:11:45 CST To: r-help@r-project.org Subject: [R] Search for a usable pan manual Joe Schafer wrote a text on missing data, the title of which escapes me and I can't say if it will be useful for your particular problem. My

Re: [R] Using windows() and jpeg()

2007-11-19 Thread Duncan Murdoch
On 19/11/2007 3:09 PM, Irina Burmenko wrote: Hello, I have the following question, which I haven't been able to resolve after days of trying. I used to save my plots as jpegs using the savePlot command. However, that seems to result in lost resolution. So now I'm trying to use the

Re: [R] reading graph metadata text from a file

2007-11-19 Thread Greg Snow
You may want to use the textplot function from the gplots package rather than the legend. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On

Re: [R] delete a row in a matrix

2007-11-19 Thread Julian Burgos
Something like this? a=matrix(1:9, ncol=3) print(a) [,1] [,2] [,3] [1,]147 [2,]258 [3,]369 a=a[-2,] print(a) [,1] [,2] [,3] [1,]147 [2,]369 You can use negative numbers to reference rows and/or columns, and you'll

[R] add points to xyplot() from alternate data frame

2007-11-19 Thread Dylan Beaudette
Hi, I am using xyplot() to produce a mutli-panel plot of logistic regression response curves. I would like to include symbols denoting the original binary response observations, however this data is located in a different dataframe than what xyplot() is using. I am first plotting the smooth,

[R] mulitmodal distributions

2007-11-19 Thread Marion Wittmann
Hello, I see that mclust is a pacakge that handles fitting mixtures of normals. Are there any other packages out that that can handle mixtures of gammas or other exponentials? Additionally, are there any packages out there that can fit bimodal distributions without mixtures? i.e., Cobb et

[R] Effective code for 2 vector multiplication?

2007-11-19 Thread Dimitri Liakhovitski
Hello! I have a data frame POPULATION populated with numeric values such that dim(POPULATION) are: 100,000 (rows) and 3 (columns). Also, I have a vector beta.vector that has 3 elements (all numeric values). I want to create a new variable Y (a new column) in POPULATION such that for each row of

Re: [R] Effective code for 2 vector multiplication?

2007-11-19 Thread Moshe Olshansky
You can use matrix by vector multiplication: m - as.matrix(POPULATION) beta - as.numeric(beta.vector) y - m %*% beta POPULATION - cbind(POPULATION,y) --- Dimitri Liakhovitski [EMAIL PROTECTED] wrote: Hello! I have a data frame POPULATION populated with numeric values such that

[R] assign if not set

2007-11-19 Thread Alexy Khrabrov
What's the idiom of assigning a default value to a variable if it's not set? In Ruby one can say v ||= default -- that's an or-assign, which triggers the assignment only if v is not set already. Is there an R shorthand? Cheers, Alexy __

[R] Plotting Non Numeric Data

2007-11-19 Thread Michal Charemza
Hi, Is there a way to plot non numerical data in R? Specifically, I have an array, say with 1000 entries, where each entry is a string of 4 characters (in any order, 24 possibilities in my case). I would like on the y-axis all the strings that are in the array as labels. The x-axis I would

Re: [R] assign if not set

2007-11-19 Thread Marc Schwartz
On Tue, 2007-11-20 at 03:32 +0300, Alexy Khrabrov wrote: What's the idiom of assigning a default value to a variable if it's not set? In Ruby one can say v ||= default -- that's an or-assign, which triggers the assignment only if v is not set already. Is there an R shorthand?

Re: [R] assign if not set; stand-alone R script, source'able too?

2007-11-19 Thread Alexy Khrabrov
Marc -- thanks, very interesting. I was in fact tinkering at a very simple default arguments assignment to a generic command-line R script header: #!/bin/sh # graph a fertility run tail --lines=+4 $0 | R --vanilla --slave --args $*; exit args - commandArgs()[-(1:4)] # the krivostroi library

Re: [R] assign if not set; stand-alone R script, source'able too?

2007-11-19 Thread Gabor Grothendieck
Here are two solutions: # 1 %or% - function(x, y) if (is.na(x)) y else x NA %or% 1 # 1 3 %or% 1 # 3 # 3 # can omit Negate- line in R 2.7.0 since its predefined there Negate - function(f) function(...) ! match.fun(f)(...) Filter(Negate(is.na), c(NA, 1))[1] # 1 Filter(Negate(is.na), c(3, 1))[1] #

Re: [R] Plotting Non Numeric Data

2007-11-19 Thread Marc Schwartz
On Tue, 2007-11-20 at 00:37 +, Michal Charemza wrote: Hi, Is there a way to plot non numerical data in R? Specifically, I have an array, say with 1000 entries, where each entry is a string of 4 characters (in any order, 24 possibilities in my case). I would like on the y-axis all

Re: [R] counting strings of identical values in a matrix

2007-11-19 Thread Moshe Olshansky
How about adding an artificial last row containing no 1's (say a row of zeros)? --- Marc Schwartz [EMAIL PROTECTED] wrote: On Thu, 2007-11-15 at 17:53 +0100, A M Lavezzi wrote: thank you. I did not think about the case of overlapping of 1's from the end of one column to the start of

Re: [R] assign if not set; stand-alone R script, source'able too?

2007-11-19 Thread Marc Schwartz
Alexy, In addition to Gabor's reply, you might want to review the following page from the R Wiki: http://wiki.r-project.org/rwiki/doku.php?id=developers:rinterp which covers LittleR by Jeff Horner and Dirk Eddelbuettel and provides shell scripting support for R. HTH, Marc On Mon, 2007-11-19

Re: [R] sample nth day data in each month

2007-11-19 Thread Gabor Grothendieck
Suggest you read the article in R News 4/1 on dates and times and try this: library(zoo) library(chron) z - zoo(101:200, seq(chron(1/1/2000), length = 100)) zz - z[with(month.day.year(time(z)), day = 21 month %% 2 == 1)] zz[!duplicated(as.yearmon(time(zz)))] On Nov 19, 2007 9:57 PM, Carles

Re: [R] Problems with NA's

2007-11-19 Thread Moshe Olshansky
The problem is that if you do the following: x - NA then x == NA returns NA (and not TRUE or even FALSE). Use is.na to test for NA (see ?is.na). --- Thomas L Jones, PhD [EMAIL PROTECTED] wrote: Difficulty handling NA's: Assume that I have a numeric vector y. For simplicity, assume that it

Re: [R] Plotting Non Numeric Data

2007-11-19 Thread jim holtman
Here is one way to plot your data: # generate 24 cases of 4 letter character strings x - expand.grid(c(A, B), c(C,D), c(E,F), c(G,H,I)) x - apply(x, 1, paste, collapse='') # data to plot y - factor(sample(x, 200, TRUE)) par(mar=c(5,6,1,1)) plot(seq_along(y), y, yaxt='n', type='l', ylab='')

Re: [R] Efficient way to compute power of a sparse matrix

2007-11-19 Thread Moshe Olshansky
Hello Stéphane, Since 20 = 4 + 16 you need 5 matrix multiplications to compute X^20 (2 for X^4, 2 more for X^16 and one more for X^20). If your matrix is NxN, one naive matrix multiplication requires about N^3 operations. In your case N is 900. If it were 1000, 1000^3 is one billion, so 5 matrix

Re: [R] Re ad HTML table

2007-11-19 Thread Duncan Temple Lang
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 theta wrote: f.jamitzky wrote: You can use htmlTreeParse and xpathApply from the XML library. something like: xpathApply( htmlTreeParse(http://blabla;, useInt=T), //td, function(x) xmlValue(x)) should do it. Thank you, any further

Re: [R] Trying to get around R

2007-11-19 Thread Loren Engrav
I am a newbie to R and Bio emails and It is clear that newbies make mistakes, I made several which were pointed out and I am trying to fix them, and as I fix one I make another, in time perhaps I will know it all, but if it is like surgery, I will make mistakes until I retire But the response of

Re: [R] Efficient way to compute power of a sparse matrix

2007-11-19 Thread Moshe Olshansky
Just a correction to my previous posting - O(N^2.25) algorithm for multiplying two general NxN matrices was too optimistic! There exists an O(N^a) algorithm with a 2.4, but the constant multiplying N^a is so big that for N around 1000 it seems that one will be unable to end up with significantly

Re: [R] Trying to get around R

2007-11-19 Thread ecatchpole
Loren, There's a good reason for replying to the list, rather than just to you personally: to let other readers of the list see the response, so that they don't duplicate it. Your original posting certainly looked like homework questions to me. This impression was reinforced by the fact that