[R] OT - use of R

2007-08-14 Thread Andy Bunn
Hello, is there an up-to-date reference for how many people use R? I'm giving an R demo and want to cite wonderful R usage stats. How many people use it (or download it)? How often is R used in peer-reviewed pubs, etc. Is there any whiz-bang citation that says something like "R is great and develop

[R] Second y-axis in xyplot (lattice) where y1 and y2 have different ranges

2007-06-18 Thread Andy Bunn
Hi all, I realize this is asking a lot of lattice, but I want to add a second y axis inside a xyplot and have y1 and y2 have different ranges. Given dat below, I can add a second y axis by overlaying a new plot with par(new=T) and label axis 4 with standard graphics. I've seen an example for doing

Re: [R] Partial whitening of time series?

2007-02-26 Thread Andy Bunn
Thanks, I wasn't thinking real clearly when I pressed 'send'. All figured out now. -A -Original Message- From: Wensui Liu [mailto:[EMAIL PROTECTED] Sent: Monday, February 26, 2007 10:15 AM To: Andy Bunn Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Partial whitening of tim

[R] Partial whitening of time series?

2007-02-26 Thread Andy Bunn
I have a time series with a one year lag, ar=0.5. The series has some interesting events that disappear when the series is whitened (i.e., fitting an AR process and looking at the residuals). I'd like to remove the autocorrelation in stages to see the effect on the time series. Is there a way to sp

Re: [R] finding common elements in a list

2006-04-08 Thread Andy Bunn
> The original post is ambiguous: do you want to find the intersection or do > you want to find whether a prespecified set is in the > intersection? Patrick > provided you an answer to the latter while you provided an answer to the > former. Actually, I thought using table as you did (mod the need

[R] finding common elements in a list

2006-04-07 Thread Andy Bunn
Suppose I have a list where I want to extract only the elements that occur in every component. For instance in the list foo I want to know that the numbers 2 and 3 occur in every component. The solution I have seems unnecessarily clunky. TIA, Andy foo <- list(x = 1:10, y=2:11, z=1:3) bar <

Re: [R] How to implement an iterative unit root test

2006-04-05 Thread Andy Bunn
Does this get you started? library(tseries) ?adf.test foo <- matrix(rnorm(1000),ncol=10,nrow=100) bar <- apply(foo,2,adf.test) sapply(bar, "[[", "statistic") sapply(bar, "[[", "p.value") HTH, Andy -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bernd Di

Re: [R] Selecting from a Dataframe

2006-04-04 Thread Andy Bunn
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Dan Chan > Sent: Tuesday, April 04, 2006 1:42 PM > To: r-help@stat.math.ethz.ch > Subject: [R] Selecting from a Dataframe > > > Hi, > > I have a data frame with many fields and there are many records. >

[R] lattice, xyplot, lend=1, type="h"

2006-03-31 Thread Andy Bunn
Is there is a way to make square bars in xyplot with type="h"? dat <- data.frame(foo = rep(1:10,2), bar = rep(1:10,2)) xyplot(foo~bar, data = dat, type="h",lwd=20) Thanks! Andy __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listi

Re: [R] matrix indexing

2006-03-15 Thread Andy Bunn
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of tom wright > Sent: Wednesday, March 15, 2006 6:04 AM > To: R-Stat Help > Subject: [R] matrix indexing > > > Can someone please give me a pointer here. > I have two matrices > > matA > A B

Re: [R] different values of a vector

2006-03-14 Thread Andy Bunn
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Arnau Mir > Sent: Tuesday, March 14, 2006 12:45 PM > To: r-help@stat.math.ethz.ch > Subject: [R] different values of a vector > > > Hello. > > I have a vector of length 2771 but it has only 87 different

Re: [R] add trend line to each group of data in: xyplot(y1+y2 ~ x | grp...

2006-03-13 Thread Andy Bunn
> -Original Message- > From: Deepayan Sarkar [mailto:[EMAIL PROTECTED] > Sent: Friday, March 10, 2006 4:10 PM > To: Andy Bunn > Cc: R-Help > Subject: Re: add trend line to each group of data in: xyplot(y1+y2 ~ x | > grp... > > > On 3/10/06, Andy

[R] add trend line to each group of data in: xyplot(y1+y2 ~ x | grp...

2006-03-10 Thread Andy Bunn
Although this should be trivial, I'm having a spot of trouble. I want to make a lattice plot of the format y1+y2 ~ x | grp but then fit a lm to each y variable and add an abline of those models in different colors. If the xyplot followed y~x|grp I would write a panel function as below, but I'm uns

[R] do.call help

2006-03-02 Thread Andy Bunn
Hello all: I have a character variable (foo) that contains the names of some numeric variables. For my application, I'd like to cbind the numeric variables and calculate the row mean using the character variable. I think I do this using do.call but the function to call using do.call is eluding me!

Re: [R] shaded timeseries plot

2006-02-22 Thread Andy Bunn
Does this thread help? https://stat.ethz.ch/pipermail/r-help/2006-February/086874.html > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Thomas Hoffmann > Sent: Wednesday, February 22, 2006 2:17 PM > To: r-help@stat.math.ethz.ch > Subject: [R] shaded tim

Re: [R] How to select only certain rows when making a new dataframe?

2006-02-21 Thread Andy Bunn
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of [EMAIL PROTECTED] > Sent: Tuesday, February 21, 2006 12:54 PM > To: r-help@stat.math.ethz.ch > Subject: [R] How to select only certain rows when making a new > dataframe? > > > Dear R-users, > > I have t

Re: [R] shading under the lines in a lattice xyplot?

2006-02-15 Thread Andy Bunn
> -Original Message- > From: Sundar Dorai-Raj [mailto:[EMAIL PROTECTED] > Sent: Wednesday, February 15, 2006 1:40 PM > To: Andy Bunn > Cc: R-Help > Subject: Re: [R] shading under the lines in a lattice xyplot? > > > > > Andy Bunn wrote: > > In the l

[R] shading under the lines in a lattice xyplot?

2006-02-15 Thread Andy Bunn
In the lattice plot below I want to fill-in the areas under each lines that are greater than zero in gray. Is there a straightforward way to go about this? Thanks, Andy library(lattice) foo <- data.frame(Yrs=rep(1:50,4), Y=rnorm(200), Id=unlist(lapply(letters[1:4],rep,50))) xyplo

[R] Butterworth low-pass filter

2005-12-16 Thread Andy Bunn
Has anybody implemented code to extract coefficients for a Butterworth low-pass filter? I know Matlab has it implemented in the signal toolbox. I want to make use of a 10 point Butterworth low-pass filter for smoothing. In Matlab the code would look like this: % Determine the filter coefficients [

[R] ltext - adding text to each panel from a matrix

2005-11-10 Thread Andy Bunn
Hi all (really probably just Deepayan): In the plot below I want to add text on either side of each violin plot that indicates the number of observations that are either positive or negative. I'm trying to do this with ltext() and I've also monkeyed about with panel.text(). The code below is gener

Re: [R] Add dots at the mean of a bwplot using panel.points

2005-11-03 Thread Andy Bunn
> How can I modify the example below to put a dot at the mean of each violin > plot? I assume I use panel.points but that's as far as I can go. > > bwplot(voice.part ~ height, singer, > panel = function(..., box.ratio) { > panel.violin(..., col = "transparent", >

[R] Add dots at the mean of a bwplot using panel.points

2005-11-03 Thread Andy Bunn
How can I modify the example below to put a dot at the mean of each violin plot? I assume I use panel.points but that's as far as I can go. bwplot(voice.part ~ height, singer, panel = function(..., box.ratio) { panel.violin(..., col = "transparent",

Re: [R] text mining with R

2005-11-03 Thread Andy Bunn
> Just wondering if anyone knows of any text mining projects in > R...I googled > a bit but didn't get anything... RSiteSearch("text mining") turns up 85 hits... __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLE

Re: [R] dataframe conversion

2005-11-01 Thread Andy Bunn
> The data structures in R are still very puzzling to me. Can anyone tell > me how I can easily convert these two dataframes to one single dataframe > with two columns (mean and sd) with 7 rows? > > > meanprofile >V1 V2 V3 V4 V5 V6 V7 > 2292.001 2178.

Re: [R] Unexpected result from binary greater than operator

2005-11-01 Thread Andy Bunn
Look at ?all.equal and ?identical as well as searching the archives for those terms. You'll find many an illuminating thread on precision, floating point arithmetic and other wonders. minX <- 4.2 min0 <- 4.1 sigmaG <- 0.1 Diff <- minX-min0 all.equal(Diff, sigmaG) identical(Diff, sigmaG) HTH, Andy

Re: [R] Graphics window always overlaps console window!

2005-10-25 Thread Andy Bunn
> Does anyone know how I can set up R so that when I make a graphic, the > graphics window remains behind the console window? It's annoying to > have to reach for the mouse every time I want to type another line of > code (e.g., to add another line to the plot). Thanks. What OS? In Windows with R

Re: [R] Predicting classification error from rpart

2005-10-14 Thread Andy Bunn
Anthony. Look at ?predict.rpart, I think this might be the kind of table you are looking for. data(iris) sub <- c(sample(1:50, 25), sample(51:100, 25), sample(101:150, 25)) fit <- rpart(Species ~ ., data=iris, subset=sub) fit table(predict(fit, iris[-sub,], type="class"),

[R] Which cex to change in a trellis plot

2005-10-14 Thread Andy Bunn
Given: foo <- data.frame(bar = rnorm(100), fac1 = factor(rep(1:2, 50)), fac2 = factor(c(rep(c("a","b","SomethingReallyReallyReallyLong"), 33),"a"))) bwplot(bar~fac1|fac2, data = foo) How do I change the size of the text for fac2? I need to make the "SomethingR

Re: [R] how to do something like " subset(mat, ("col1">4 & "col2">4)) "

2005-09-09 Thread Andy Bunn
Some thing like this? mat <- matrix(1:9,3,3) mat mat[apply(mat[,2:3] > 4,1,all),] # or less cryptically foo <- mat[,2:3] > 4 bar <- apply(foo,1,all) mat[bar,] HTH, Andy NB: No need to send this kind of message to r-devel > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL P

Re: [R] Newbie help on dim

2005-09-01 Thread Andy Bunn
Check out the "dim vs length for vectors" thread: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/50720.html This thread goes through the bug-or-feature discussion which is always entertaining from a socio-R perspective. Also, note "Dim" with a capital D doesn't exist. HTH, Andy > -Origin

Re: [R] cbind and rbind

2005-08-22 Thread Andy Bunn
#x27;t and get eviscerated by some R-guru, but that's part of the fun of it all! I hope that helps, Andy > -Original Message- > From: Tony Evans [mailto:[EMAIL PROTECTED] > Sent: Monday, August 22, 2005 8:03 PM > To: Andy Bunn > Subject: Re: [R] cbind and rbind > > > Sor

Re: [R] extracting row means from a list

2005-07-19 Thread Andy Bunn
I think about half of my question in R can be solved with a judicious do.call. Thanks, Andy __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.ht

[R] extracting row means from a list

2005-07-19 Thread Andy Bunn
Hello: I'm reading in a series of text files (100 files that are each 2000 rows by 6 columns). I wish to combine the columns (6) of each file (100) and get the row mean. I'd like to end up with a data.frame of 2000 rows by 6 columns. foo <- list() for(i in 1:10){ # The real data are read in f

RE: [R] ts.intersect a multivariate and univariate ts

2005-06-06 Thread Andy Bunn
> > > > R > w <- list(rnorm(10), rnorm(10)) > > R > x <- ts(w, start = 1980) > > Even though you don't get an error message this statement is > erroneous. ?ts discusses the valid possibilities. So it does, might I suggest add something like this to ts: if (is.list(data)) stop("Data

RE: [R] ts.intersect a multivariate and univariate ts

2005-06-05 Thread Andy Bunn
> some_df[1, ] is actually a data frame: see ?"[.data.frame". It's hard to > see what else it could be, as columns of a data frame are of arbitrary > classes. I see, I was confusing class and mode. However, since a list can be a ts object as in this example: R > w <- list(rnorm(10), rnorm(10)) R

RE: [R] ts.intersect a multivariate and univariate ts

2005-06-04 Thread Andy Bunn
Adam: > Providing a reproducible example would be a first step... That's the problem, I can't. But I str has come to the rescue: R > str(rw) Time-Series [1:307] from 1690 to 1996: 0.986 1.347 1.502 1.594 1.475 ... R > str(pg) List of 264 $ : num 0.227 $ : num 0.189 $ : num 0.237 $ : num 0.23

[R] ts.intersect a multivariate and univariate ts

2005-06-03 Thread Andy Bunn
This seems like a FAQ, but I can't figure it out. I have a mv ts object: R > tsp(pg) [1] 1982 20031 R > dim(pg) [1] 22 12 and a univariate ts: R > tsp(rw) [1] 1690 19961 Yet, when I try to intersect them: R > tsp(ts.intersect(rw, pg)) [1] 1982 21761 the process goes awry. How to

RE: [R] Preprocessing troublesome files in R - looking for some perl like functionality

2005-06-02 Thread Andy Bunn
> x <- readLines(...) > tmp <- file() > writeLines(x[substr(x, 83, 86) == "STD"], tmp) > read.fwf(tmp, ...) I wrapped this approach into function and it worked swimmingly. Thanks all. -Andy __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/m

[R] Preprocessing troublesome files in R - looking for some perl like functionality

2005-06-02 Thread Andy Bunn
Hi all: I have acquired a 100s of data files that I need to preprocess to get them usable in R. The files are fixed width (to a point) and contain 1 to 3 lines of header, followed by a variable number of fixed width data lines (that I can read with read.fwf). I want to read through the files and r

RE: [R] congratulations to the JGR developers

2005-05-02 Thread Andy Bunn
> I have not tried JGR but regarding your three adjective describing R, > R is very powerful but I am not sure I would characterize it as simple > and elegant -- complex and practical seem nearer to the mark to me. I take umbrage (and not in the sense of affording shade). Take 'simple' to mean pl

RE: [R] congratulations to the JGR developers

2005-05-02 Thread Andy Bunn
> Just want to offer my congratulations to the JGR developers as > the recepient > of the 2005 Chambers Award. Great job, guys!! > http://stats.math.uni-augsburg.de/JGR/ This feels like the future of R to me. It's simple, powerful, and elegant just like R. As soon as the binary that works with 2.

RE: [R] shading in line plots

2005-04-28 Thread Andy Bunn
> PS 6 days to the big Jedi holiday! I wonder if anybody who gave the matter any thought would be surprised that the R-Help list is populated by ubergeeks. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do r

RE: [R] Summarizing factor data in table?

2005-04-26 Thread Andy Bunn
The three was a typo, which I regret very much. I don't know why I didn't think of apply. I was obsessed with doing it as a table. Thanks for your response, -Andy > -Original Message- > From: Tony Plate [mailto:[EMAIL PROTECTED] > Sent: Tuesday, April 26, 2005 2:00 PM &

[R] Summarizing factor data in table?

2005-04-26 Thread Andy Bunn
I have a very simple query with regard to summarizing the number of factors present in a certain snippet of a data frame. Given the following data frame: foo <- data.frame(yr = c(rep(1998,4), rep(1999,4), rep(2000,2)), div = factor(c(rep(NA,4),"A","B","C","D","A","C")),

RE: [R] Tool for update

2005-04-22 Thread Andy Bunn
Hi Ronaldo: First, this script was discussed a few days ago. Note that under 2.1 update.packages() has changed for the better. Look at the NEWS file. So, if you want to keep updating on Tuesdays, despite sensible advice to the contrary offered in this thread http://finzi.psych.upenn.edu/R/Rhelp02

RE: [R] Howto overlay two plots and save them in one pdf file?

2005-04-21 Thread Andy Bunn
> > Do you mean a second y axis? If so then something like this would > > do it > > Not exactly, I would also take advantage of overlaying the fitting > curve of LAD on OLS, since both rely on the same dataset. Maybe two > regression lines with varying shapes (i.E. straight versus dotted > line) Li

RE: [R] Howto overlay two plots and save them in one pdf file?

2005-04-21 Thread Andy Bunn
> Well for comparatative reason I would would like to subsume both plots > into a unifying plot and save them in one file.pdf. > I tried to find an answer in FAQ and mailinglists archive, no luck. > Maybe did miss an appropiate answer to my question, so a pointer to > solve my problem woud be su

RE: [R] Re: automatic updating

2005-04-19 Thread Andy Bunn
The Tuesday update script came back to get me! I knew it would. update.packages has changed (for the better) with this release. Look at the NEWS file: The 'CRAN' argument to update.packages(), old.packages(), new.packages(), download.packages() and install.packages() is de

RE: [R] Finding seasonal peaks in a time series....

2005-01-13 Thread Andy Bunn
This is inelegant, but works: # (following the example) nPts <- 254 foo <- sin((2 * pi * 1/24) * 1:nPts) foo <- foo + rnorm(nPts, 0, 0.05) bar <- ts(foo, start = c(1980,3), frequency = 24) mean.in.i <- numeric(length(start(bar)[1]:end(bar)[1])) peak.ts <- ts(rep(NA, length(foo)), start = c(1980,

RE: [R] count element in column

2005-01-05 Thread Andy Bunn
How about this? length(res[res < 0, 1]) HTH, Andy > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Frederic renaud > Sent: Wednesday, January 05, 2005 11:08 AM > To: r-help@stat.math.ethz.ch > Subject: [R] count element in column > > > Hi, > I 've a ma

RE: [R] Adding a polygon to a time series plot

2004-12-10 Thread Andy Bunn
Arggh! start and end. Of course. How stupid of me. And I'm not going to interpolate with smooth.spline, but thanks for the warning. Sloppy language. Thanks, Andy > -Original Message- > From: Liaw, Andy [mailto:[EMAIL PROTECTED] > Sent: Friday, December 10, 2004 2:49 PM &g

[R] Adding a polygon to a time series plot

2004-12-10 Thread Andy Bunn
Preamble: Sorry for being dense. Now that that's done, here are my questions. I want to put a polygon on a plot of a time series. I'm going to add lines from a smooth.spline interpolation and other annotation to it. But here's the general idea: # Start code n <- 121 dat <- rnorm(n)

RE: [R] Scatterplot question

2004-12-09 Thread Andy Bunn
Something like this will work: foo.df <- data.frame(x = 1:8, y1 = c(1,3,5, NA, NA, NA, NA, NA), y2 = c(NA, NA, NA, 7, 9, 11, NA, NA), y3 = c(NA, NA, NA, NA, NA, NA, 13, 15)) plot(foo.df$x, foo.df$y1, ylim = c(0,20), type = "n") points(foo

RE: [R] vector to matrix transformation

2004-12-03 Thread Andy Bunn
In addition to Sean's reply look at ?dist and other ways of creating distance / similarity matrices for applications like Mantels Test. Package vegan might be particularly useful. HTH, Andy R > x <- rnorm(10) R > y <- dist(x) R > str(x) num [1:10] -0.431 0.564 0.901 -1.407 -0.991 ... R > str(y

RE: [R] Info

2004-11-30 Thread Andy Bunn
It looks like factanal is unable to optimize from these starting values (kinda like the error message says). So, factanal.fit.mle isn't converging and you have problems with your analysis. Try putting control = list(trace = T) in your code to see what happenens. E.g., R > R > v1 <- c(1,1,1,1,

RE: [R] Seeking help with a simple loop construction

2004-11-29 Thread Andy Bunn
Does this do what you want? foo.df <- data.frame(x = rnorm(12), y = runif(12), z = factor(rep(1:3,4))) bar.mat <- matrix(NA, nrow = ncol(foo.df)-1, ncol = nlevels(foo.df$z)) for(i in 1:(ncol(foo.df)-1)) { bar.mat[i,] <- xtabs(foo.df[,i] ~ foo.df$z) } bar.mat There's probably a slicker way wi

RE: [R] Citation

2004-11-29 Thread Andy Bunn
See the function ?citation under 2.0.0 R > citation() To cite R in publications use: R Development Core Team (2004). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. ISBN 3-900051-07-0, URL http://www.R-project.org. HTH,

RE: [R] an R function to search on Prof. Baron's site

2004-11-24 Thread Andy Bunn
Using this function with 2.0.0 XP and Firefox 1.0 (I've rediscovered the internet) produces a curious result. > myString <- RSiteSearch(string = 'Ripley') > myString [1] "http://finzi.psych.upenn.edu/cgi-bin/htsearch?config=htdigrun1;restrict=Rhe lp00/archive|Rhelp01/archive|Rhelp02a/archive;forma

RE: [R] Create a vector of combinations based on a table column names

2004-11-23 Thread Andy Bunn
There has to be a better (more readable) way, but this works... > set.seed(323) > foo.df <- data.frame(A = round(runif(5)), B = round(runif(5)), C = round(runif(5))) > foo.df A B C 1 0 1 1 2 1 1 1 3 1 1 1 4 0 1 1 5 1 1 0 > names.list <- lapply( apply( foo.df, 1, function( x ) colnames( foo.df )[

RE: [R] Running sum

2004-11-19 Thread Andy Bunn
see ?cumsum x <- 1:10 cumsum(x) max(cumsum(x)) HTH, Andy > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Sean Davis > Sent: Friday, November 19, 2004 1:09 PM > To: r-help > Subject: [R] Running sum > > > I have vector X of length N that I want to ha

[R] Time difference in months? (difftime, units)

2004-11-17 Thread Andy Bunn
Is there a way to calculate the number of months between dates? StartDate <- strptime("01 March 1950", "%d %B %Y") EventDates <- strptime(c("01 April 1955", "01 July 1980"), "%d %B %Y") difftime(EventDates, StartDate) So, there are 61 months between 01 March 1950 and 01 April 1955. There are 364

RE: [R] Changing zeros to NAs in a data frame

2004-11-16 Thread Andy Bunn
This isn't pretty but it's a way to do it: foo <- data.frame(x = c(1,0,1,1,0,2,4), y = as.factor(c(0,2,1,1,0,3,1))) Zero2NA <- function(x){ if(is.numeric(x)) { x[x == 0] <- NA; } return(x) } foo2 <- as.data.frame(lapply(foo, Zero2NA)) foo foo2 HTH, Andy > -Original Message- > Fr

RE: [R] Simple plot() question

2004-11-16 Thread Andy Bunn
Hi Mick: I'm a little unsure if this is what you are after but does this do it? foo.mat <- matrix(rnorm(100), nrow = 10, ncol = 10) plot(foo.mat[1,], type="l", xlab = "Crud", ylab = "More Crud") plot(foo.mat[1,order(foo.mat[1,])], type="l", xaxt = "n", xlab = "Crud", ylab = "More Crud") axis(1, a

RE: [R] tsdiag() titles

2004-11-15 Thread Andy Bunn
You can use title, but the result is unsatisfying: > fit <- arima(lh, c(1,0,0)) > tsdiag(fit) > title("junk") Perhaps mtext with an appropriate par configuration? HTH, Andy > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Andrew Kniss > Sent: Monday

RE: [R] Using R in parallel on a 2 processor machine

2004-11-15 Thread Andy Bunn
How about installing an operating system that knows its way around that much RAM? > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Graham Law > Sent: Monday, November 15, 2004 9:12 AM > To: [EMAIL PROTECTED] > Subject: [R] Using R in parallel on a 2 proc

[R] scan or source a text file into a list

2004-11-11 Thread Andy Bunn
I've ported somebody else's rather cumbersome Matlab model to R for colleagues that want a free build of the model with the same type of I/O. The Matlab model reads a text file with the initial parameters specified as: C:\Data\Carluc\Rport>more Params.R # Number of years to simulate nYears = 50;

RE: [R] Logical "and"

2004-11-11 Thread Andy Bunn
How about this? a<-c(1,7,4,5,9,11) b<-c(7,4,9) a[!a %in% b] b<-c(7,4,9, 100, 20, 34, 54) a[!a %in% b] see ?match, too HTH, Andy > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Alexander Sokol > Sent: Thursday, November 11, 2004 8:34 AM > To: [EMAIL

RE: [R] Does something like partition.rpart() exist?

2004-11-10 Thread Andy Bunn
I might well be wrong, but I don't think there is. I went about rewriting partition.tree for rpart once but stopped after I realized that it was much easier to add lines and segments to plots by hand using the coordinates from the rpart object (I then added a third predictor to my dataset making th

RE: [R] Boxplot plot range

2004-11-09 Thread Andy Bunn
How about using ylim? foo <- rnorm(100, 0, 1) boxplot(foo, ylim = c(-5, 5)) HTH, Andy > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Scott Rifkin > Sent: Tuesday, November 09, 2004 2:43 PM > To: [EMAIL PROTECTED] > Subject: [R] Boxplot plot range >

RE: [R] Error in update() when repositories is specified.

2004-11-09 Thread Andy Bunn
Ooops. Make that subject line 'upgrade', not 'update!' Sorry. -AB > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Andy Bunn > Sent: Tuesday, November 09, 2004 9:23 AM > To: R-Help > Subject: [R] Error in u

[R] Error in update() when repositories is specified.

2004-11-09 Thread Andy Bunn
How can I specify the repositories for upgrade()? > x <- packageStatus(repositories = "http://cran.us.r-project.org//bin/windows/contrib/2.0";) > upgrade(x, ask = FALSE) Error in update[, 3] : incorrect number of dimensions x, the object of class "packageStatus", prints and summarizes fine. I als

RE: [R] plotting lm coeficients with their means

2004-11-08 Thread Andy Bunn
How about something like this? my.func <- function(y, x1, x2, x3, x4 = NULL){ my.formula <- as.formula("y ~ x1 + x2 + x3 + x4") if(is.null(x4)) { my.formula <- as.formula("y ~ x1 + x2 + x3") } outlm <- lm(my.formula) meanvec<-c(mean(x1),mean(x2),mean(x3)) if(is.null(x4) == F)

RE: [R] Newbie question: plotting regression models

2004-11-03 Thread Andy Bunn
Welcome to R. You can start by looking at the predict function for the regression model you are using (e.g., ?predict.lm if you are using a linear model). Then do something like so: data(cars) cars.lm <- lm(dist ~ speed, cars) dist.pred <- predict(cars.lm) plot(cars$speed, cars$dist, ylim = c(-

[R] install.packages, bundles, pmatch, and Rprofile...

2004-11-02 Thread Andy Bunn
Hi, Somebody asked me to make sure that all the machines running the in our lab (XP and Linux, both running 2.0) have R installed and that A) All the packages are installed and B) kept up-to-date. Obediently, I began to modify a shared Rprofile so that once a week it checks for new packages and u

RE: [R] n-th power of a matrix

2004-11-02 Thread Andy Bunn
Load the library first: > library(Malmig) > ?mtx.exp HTH, Andy __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

RE: [R] Reading word by word in a dataset

2004-11-01 Thread Andy Bunn
Something like this should work: foo <- read.table("text2read.txt", colClasses=c("character", "NULL", "NULL"))$V1 foo <- gsub("i[0-9]-", "", foo) HTH, Andy __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read th

RE: [R] deleting specified NA values

2004-11-01 Thread Andy Bunn
I think you want something like so: # make some data foo.df <- data.frame(x = 1:100, y = runif(100), age = rnorm(100, 10, 1)) # stick some "real" NAs in all columns foo.df[c(2,78,32,56),] <- NA # make some "errant" NAs in the column age foo.df$age[c(99, 26, 75, 3)] <- NA # eg foo.df[1:5,] # remove

RE: [R] R & Graphs

2004-10-20 Thread Andy Bunn
In addition, look at "Laying Out Pathways With Rgraphviz" in R News which describes the Rgraphviz packages on Bioconductor. http://cran.r-project.org/doc/Rnews/Rnews_2004-2.pdf HTH, Andy __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/li

RE: [R] Filling polygons with points

2004-10-14 Thread Andy Bunn
> I made a quick search and was unable to find a general implementation > of the "interior" function for an arbitrary polygon; I'm a bit > surprised about that. Hopefully someone else can point to one, > otherwise please write one, and document it and contribute it to R. > It's a relatively standa

RE: [R] RWinEdt

2004-10-08 Thread Andy Bunn
Anna: That is the most current version of RWinEdt. Uwe Ligges is working on a version for 2.0.0 so check back soon for a new release. http://cran.r-project.org/contrib/extra/winedt/ Also, when inquiring about a specific package it is often helpful to contact the maintainer directly and not R-hel

RE: [R] How do I insert a newline in my title in a plot?

2004-09-16 Thread Andy Bunn
You had it. plot(1:5, main = "This is a title\nIn 2 lines") HTH, Andy __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

RE: [R] Conditionally swap two columns of a data.frame?

2004-09-16 Thread Andy Bunn
ifelse accomplishes this pretty easily (at least I think it does what you want) Look at ?apply too. HTH, Andy ## Try this foo.dat <- data.frame(Var1 = rnorm(4, 1, 1), Var2 = (rnorm(4, 1, 1) * 0.25)) plot(density(foo.dat$Var1 / foo.dat$Var2)) RatioOne <- ifelse(fo

RE: [R] don't stop when error occurs

2004-03-18 Thread Andy Bunn
You can do that easily with 'try' ?try 'try' is a wrapper to run an expression that might fail and allow the user's code to handle error-recovery. HTH, Andy __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help

RE: [R] bray-curtis?

2004-03-16 Thread Andy Bunn
Look at the function vegdist in the library vegan. It does Bray-Curtis and other common ecological distance measures. HTH, Andy __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! ht

RE: [R] Simple numeric "as.is" question

2004-03-15 Thread Andy Bunn
Look at the help for: ?as.numeric HTH, Andy > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Janet Gannon > Sent: Monday, March 15, 2004 7:04 AM > To: [EMAIL PROTECTED] > Subject: [R] Simple numeric "as.is" question > > > I am reading a list of numb

RE: [R] (no subject)

2004-03-12 Thread Andy Bunn
Look at ?Extract myDF <- data.frame(c1 = c(1,1,1,1,2,2,2,2), c2 = c(23,34,45,45,78,65,45,70), c3 = c(12,15,67,87,23,19,90,32)) mean(myDF[myDF$c2 == 45,3]) HTH, Andy __ [EMAIL PROTECTED] mailing list https://www.s

RE: [R] saving a data.frame to "\t" files

2004-03-11 Thread Andy Bunn
?write.table setwd("c:\\temp") myDF <- data.frame(A = rnorm(100), B = rnorm(100)) write.table(myDF, file = "myDF.dat", sep = "\t", quote = F, row.names = F) HTH, Andy __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-he

RE: [R] Questions about spatial data

2004-03-11 Thread Andy Bunn
See the splancs library and the functions gridpts pcp.sim csr in particular. However, what you want to do is not completely trivial. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting gu

[R] Center labels on a boxplot

2004-03-10 Thread Andy Bunn
Suppose that I have data on three species for a variable and datasets from two time periods. I want to make a boxplot of the first dataset and then add the second using 'at = ' and 'add = T' as in the example for 'boxplot.' Since the boxes are paired by species, I want to do is have the x labels b

RE: [R] how to use conditional statements to handle exceptions?

2004-03-09 Thread Andy Bunn
If you mean to put a check in to see if the file exists then something like this would work: for(i in 1:3){ aFile <- paste("file", i, ".dat", sep = "") if(file.exists(aFile) == T){ bb <- read.table(aFile, header = F) x11() plot(bb) dev.off() } } If

RE: [R] Command Line Programs

2004-03-04 Thread Andy Bunn
?source > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Kissell, Robert [EQRE] > Sent: Thursday, March 04, 2004 3:19 PM > To: [EMAIL PROTECTED] > Subject: [R] Command Line Programs > > > Hi, > I have recently started using R again (switched fro

RE: [R] using object reference

2004-03-02 Thread Andy Bunn
Don't you just need to use return? x <- 1 attr(x,'a') <- 'some text' f <- function(z) { attr(z,'a') <- 'some new text' return(z) } y <- f(x) y __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the

RE: [R] superimposing two scatterplots

2004-03-01 Thread Andy Bunn
?points plot(-4:4, -4:4, type = "n")# setting up coord. system points(rnorm(200), rnorm(200), col = "red") points(rnorm(100)/2, rnorm(100)/2, col = "blue", cex = 1.5) > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > On Behalf Of Raphael Schoenl

RE: [R] How to save images?

2004-02-27 Thread Andy Bunn
Try the FAQ http://cran.r-project.org/faqs.html Or one of the manuals http://cran.r-project.org/faqs.html But first read the posting guide http://www.R-project.org/posting-guide.html > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Susan Lin > Sent:

RE: [R] adding header info to write.table

2004-02-26 Thread Andy Bunn
> Is everybody writing ArcGIS ASCII rasters recently? The GIS community is hopelessly tied to ESRI. So many people have invested their careers in learning Arc that switching to GRASS is an institutional nightmare. Most of what I do now is outside of Arc! And certainly outside of their almost usele

RE: [R] adding header info to write.table

2004-02-26 Thread Andy Bunn
You know...I almost added this to your original post because I thought you might want to read something back into ArcInfro when you were done! Look at ?files The easiest thing to do in R is to keep your header as a text file in the working directory and then append it to your output file using 'f

RE: [R] minimum value

2004-02-25 Thread Andy Bunn
min(v) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of li xian Sent: Wednesday, February 25, 2004 8:46 PM To: [EMAIL PROTECTED] Subject: [R] minimum value suppose I have a vector called v, how can I get the index of the minimum element of vector v? Th

RE: [R] help for MLE

2004-02-22 Thread Andy Bunn
I fear you have a problem with your parentheses. The '>' sign turns to a '+' when the line is incomplete. See the R-FAQ for information. This evaluates but I'm not sure if it's what you want fn < -function(x){ (-50*log((sd(x))^2))-50*log(sqrt(2*pi))-(1/2*((mean(x))^2))*(sum((x-(mea n(x))^2))

RE: [R] importing ascii grids (for gstat)

2004-02-19 Thread Andy Bunn
No problem. I'm glad it worked. It would be pretty easy to package as a function for gstat. -Andy > -Original Message- > From: femke [mailto:[EMAIL PROTECTED] > Sent: Thursday, February 19, 2004 2:54 PM > To: Andy Bunn > Subject: Re: [R] importing as

[R] Conjugate function found disregard pervious posting...

2004-02-18 Thread Andy Bunn
Sorry for the previous posting. I found the function in ?complex. My apologies. -Andy __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

  1   2   >