[R] Redirecting print output

2007-07-24 Thread Stan Hopkins
I see a rich set of graphic device functions to redirect that output. Are there commands to redirect text as well. I have a set of functions that execute many linear regression tests serially and I want to capture this in a file for printing. Thanks, Stan Hopkins [[alternative HTML

Re: [R] OT(slightly) - Tracking extended projects

2007-07-24 Thread D L McArthur
James MacDonald jmacdon at med.umich.edu writes: Hi all, Most of the analyses I do are short little once-and-done type things that are easily encapsulated in a .Rnw file. However, I sometimes end up with projects that take an extended amount of time. Usually these projects are not

[R] function optimization: reducing the computing time

2007-07-24 Thread Matthieu Dubois
Dear useRs, I have written a function that implements a Bayesian method to compare a patient's score on two tasks with that of a small control group, as described in Crawford, J. and Garthwaite, P. (2007). Comparison of a single case to a control or normative sample in neuropsychology:

Re: [R] The 'REP' term in AMMI{agricolae}

2007-07-24 Thread joris . dewolf
The AMMI senso strictu part starts from the corrected data for genotype and environment. In most cases where AMMI is applied (maybe also in the agricolae package, I haven't checked), starts from the interaction effects obtained through a general linear model anova. It should be possible to

Re: [R] Redirecting print output

2007-07-24 Thread Vladimir Eremeev
Stan Hopkins wrote: I see a rich set of graphic device functions to redirect that output. Are there commands to redirect text as well. I have a set of functions that execute many linear regression tests serially and I want to capture this in a file for printing. Thanks, Stan

Re: [R] Redirecting print output

2007-07-24 Thread Stephen Tucker
Here are two simple ways: === method1 === cat(line1,\n,file=output.txt) cat(line2,\n,file=output.txt,append=TRUE) === method2 === sink(output.txt) cat(line1,\n) cat(line2,\n) out - lm(y~x,data=data.frame(x=1:10,y=(1:10+rnorm(10,0,0.1 print(out) sink() And then there is 'Sweave'. Check out,

Re: [R] OT(slightly) - Tracking extended projects

2007-07-24 Thread Heinz Tuechler
At 22:36 23.07.2007 +, D L McArthur wrote: James MacDonald jmacdon at med.umich.edu writes: Hi all, Most of the analyses I do are short little once-and-done type things that are easily encapsulated in a .Rnw file. However, I sometimes end up with projects that take an extended amount

[R] geoR/likfit: variance explained by model

2007-07-24 Thread Ailsa Kerswell
I have been modelling spatial data using function likfit in package geoR. Now that I have the spatial regression models, I would like to calculate the amount of variance explained by both the trend and the spatial parts of the model. Any advice on how to do this would be much appreciated.

Re: [R] persp and greek symbols in the axes labels

2007-07-24 Thread Stephen Tucker
I don't know why it doesn't work but I think people generally recommend that you use wireframe() in lattice rather than persp(), because wireframe is more customizable (the pdf document referred to in this post is pretty good): http://tolstoy.newcastle.edu.au/R/e2/help/07/03/12534.html Here's an

Re: [R] function optimization: reducing the computing time

2007-07-24 Thread Prof Brian Ripley
You need to make use of the profiling methods described in 'Writing R Exensions'. My machine is about 4x faster than yours: I get Each sample represents 0.02 seconds. Total run time: 62.08041 seconds. Total seconds: time spent in function and callees. Self seconds: time spent in

Re: [R] Fitting exponential curve to data points

2007-07-24 Thread Ted Harding
On 24-Jul-07 01:09:06, Andrew Clegg wrote: Hi folks, I've looked through the list archives and online resources, but I haven't really found an answer to this -- it's pretty basic, but I'm (very much) not a statistician, and I just want to check that my solution is statistically sound.

[R] Warning generated by Panda GateDefender Integra.

2007-07-24 Thread gatedefender
07/24/2007 11:10:07 [GMT+0100] For security reasons certain items found in an email with your address as the sender have not been accepted. File name: attachment.zip Filtered by: Malformed messages Sender: r-help@stat.math.ethz.ch Recipients: [EMAIL PROTECTED] CC:

Re: [R] Fitting exponential curve to data points

2007-07-24 Thread Stephen Tucker
I think your way is probably the easiest (shockingly). For instance, here are some alternatives - I think in both cases you have to calculate the coefficient of determination (R^2) manually. My understanding is that multiple R^2 in your case is the usual R^2 because you only have one predictor

Re: [R] Fitting exponential curve to data points

2007-07-24 Thread Stephen Tucker
Well spoken. And since log transformations are nonlinear and 'compresses' the data, it's not surprising to find that the fit doesn't look so nice while the fit metrics tell you that a model does a good job. --- [EMAIL PROTECTED] wrote: On 24-Jul-07 01:09:06, Andrew Clegg wrote: Hi folks,

[R] values from a linear model

2007-07-24 Thread Manuele Pesenti
Dear R users, how can I extrapolate values listed in the summary of an lm model but not directly available between object values such as the the standard errors of the calculated parameters? for example I got a model: mod - lm(Crd ~ 1 + Week, data=data) and its summary: summary(mod) Call:

Re: [R] problems with character objects and calls to list() [solved]

2007-07-24 Thread Neil Shephard
Thanks to Patrick Burns and Mark Lyman for their suggestions in solving my problem. Patrick suggested creating the list directly (the solution I opted for) On 7/23/07, Patrick Burns [EMAIL PROTECTED] wrote: Why not make the list directly: list.to.convert - vector('list', n) for(x in 1:n)

Re: [R] values from a linear model

2007-07-24 Thread ONKELINX, Thierry
It's not very clear to me but I think summary(mod)$coef[, Std. Error] is wat you need? Cheers, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel

Re: [R] values from a linear model

2007-07-24 Thread Dimitris Rizopoulos
try this: coef(summary(mod))[, Std. Error] I hope it helps. 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:

Re: [R] values from a linear model

2007-07-24 Thread Vladimir Eremeev
Manuele Pesenti wrote: Dear R users, how can I extrapolate values listed in the summary of an lm model but not directly available between object values such as the the standard errors of the calculated parameters? for example I got a model: mod - lm(Crd ~ 1 + Week, data=data)

Re: [R] extension of rnormp package

2007-07-24 Thread Elio Mineo
Il giorno mar, 24/07/2007 alle 06.39 +0100, Prof Brian Ripley ha scritto: On Mon, 23 Jul 2007, Iwona Szyd?owska wrote: Hello, I would like to ask You, how to generate random numbers from an exponential power family with a shape parameter p less than 1(p-0). I found the rnormp

Re: [R] nnet 10-fold cross-validation

2007-07-24 Thread David Meyer
Hi all, there is tune() in the e1071 package for doing this in general, and, among others, a tune.nnet() wrapper (see ?tune): tmodel = tune.nnet(Species ~ ., data = iris, size = 1:5) summary(tmodel) Parameter tuning of `nnet': - sampling method: 10-fold cross validation - best

[R] Overlaying a single contour from a new data array in levelplot

2007-07-24 Thread Jenny Barnes
Dear R-Help community, I am trying to overlay a single contour line over a correlation plot using levelplot in the lattice package. These are the two arrays: 1) a correlation plot over Africa - so each grid square is a different colour dependent on correlation - this is in an array: result_cor

Re: [R] Fitting exponential curve to data points

2007-07-24 Thread Andrew Clegg
Stephen, Ted -- thanks for your input. I'm glad to know I was barking up the right-ish tree at least. On 7/24/07, Ted Harding [EMAIL PROTECTED] wrote: There are not enough data to properly identify the non-linearity, but the overall appearance of the data plot suggests to me that you should

[R] plotting gam models

2007-07-24 Thread Lucia Zarauz
Hi everybody, I am working with gams and I have found some questions when plotting gams models. I am using mgcv, and my model looks something like this: model- gam(x ~ s(lat,long)) I can plot the output of the model using plot(model) or plot.gam(model) and I get a surface plot. That is

[R] Fwd: Re: Fitting exponential curve to data points

2007-07-24 Thread Stephen Tucker
Hope these help for alternatives to lm()? I show the use of a 2nd order polynomial as an example to generalize a bit. Sometimes from the subject line two separate responses can appear as reposts when in fact they are not... (though there are identical reposts too). I should probably figure a way

Re: [R] plotting gam models

2007-07-24 Thread Henrique Dallazuanna
see ?predict.gam -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O On 24/07/07, Lucia Zarauz [EMAIL PROTECTED] wrote: Hi everybody, I am working with gams and I have found some questions when plotting gams models. I am using mgcv, and my model looks something like

Re: [R] plotting gam models

2007-07-24 Thread Lucia Zarauz
Hi Henrique, Thank you for your suggestion. Actually, I have already tried it, but I am confused because the plot I get is not the same as the output of plot(model) or plot.gam(model). The yaxis is different On the other hand, if I build a more complex model, as for example: model- gam(x ~

Re: [R] plotting gam models

2007-07-24 Thread Rod
2007/7/24, Lucia Zarauz [EMAIL PROTECTED]: Hi everybody, I am working with gams and I have found some questions when plotting gams models. I am using mgcv, and my model looks something like this: model- gam(x ~ s(lat,long)) I can plot the output of the model using plot(model) or

Re: [R] plotting gam models

2007-07-24 Thread Simon Wood
Thank you for your suggestion. Actually, I have already tried it, but I am confused because the plot I get is not the same as the output of plot(model) or plot.gam(model). The yaxis is different -- `plot.gam' will always plot the `centered smooth', i.e. the smooth constrained to sum to

Re: [R] persp and greek symbols in the axes labels

2007-07-24 Thread Prof Brian Ripley
On Tue, 24 Jul 2007, Stephen Tucker wrote: I don't know why it doesn't work but I think people generally recommend that It has never been implemented, and I believe the main reason is that the labels are plotted at an angle other than a multiple of 90 degrees. Not all devices can do that,

[R] recursive vectorized arithmetics

2007-07-24 Thread Boguslaw Kluge
Hi, I would like to write something similar to: for(t in 1:100) v[x[t]] - v[y[t]] + v[z[t]] in a vectorized form. The x, y, and z vectors may contain duplicates (so v[x] - v[y] + v[z] has different semantics). The for loop is not efficient enough for my purposes and I

Re: [R] persp and greek symbols in the axes labels

2007-07-24 Thread Nathalie Peyrard
Thank you for these answers. I ended up modifying the ps file directly. But next time I will consider wireframe. Nathalie Prof Brian Ripley wrote: On Tue, 24 Jul 2007, Stephen Tucker wrote: I don't know why it doesn't work but I think people generally recommend that It has never been

Re: [R] Fitting exponential curve to data points

2007-07-24 Thread Andrew Clegg
On 7/24/07, Stephen Tucker [EMAIL PROTECTED] wrote: Hope these help for alternatives to lm()? I show the use of a 2nd order polynomial as an example to generalize a bit. Great, thanks. If I want to demonstrate that a non-linear curve fits better than an exponential, what's the best measure for

Re: [R] Fitting exponential curve to data points

2007-07-24 Thread Karl Ove Hufthammer
Andrew Clegg: Great, thanks. If I want to demonstrate that a non-linear curve fits better than an exponential, what's the best measure for that? Given that neither of nls() or optim() provide R-squared. You really need to *very* careful when trying to interprete R² (which can be defined in

[R] Comparing a distance vs. correlation matrices

2007-07-24 Thread Urmi Trivedi
Hi all, I am a student of MRes Bioinformatics and Comp. Biology at University of Leeds, UK. I am trying to compare two matrices in R. One is the matrix containing distance and the other one contains the correlation values. I would like to create a XY plot of these matrices and do some linear

[R] Fit t distribution

2007-07-24 Thread livia
Hi all, I am trying to fit t distribution using the function tFit in the library(fBasics). I am using the code tFit(datac[[2]]) and it returns the following list. Title: Student-t Parameter Estimation Call: tFit(x = datac[[2]]) Model: Student-t Distribution Estimated Parameter(s):

Re: [R] Fit t distribution

2007-07-24 Thread Henrique Dallazuanna
Hi, tFit(datac[[2]])@fit$estimate -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O On 24/07/07, livia [EMAIL PROTECTED] wrote: Hi all, I am trying to fit t distribution using the function tFit in the library(fBasics). I am using the code tFit(datac[[2]]) and it

Re: [R] Fit t distribution

2007-07-24 Thread livia
It works. Many thanks Henrique Dallazuanna wrote: Hi, tFit(datac[[2]])@fit$estimate -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O On 24/07/07, livia [EMAIL PROTECTED] wrote: Hi all, I am trying to fit t distribution using the function tFit in the

[R] apply incompatible dimensions error

2007-07-24 Thread Bernzweig, Bruce \(Consultant\)
Hi, I've created the following two matrices (mat1 and mat2) and a function (f) to calculate the correlations between the two on a row by row basis. mat1 - matrix(sample(1:500,50), ncol = 5, dimnames=list(paste(row, 1:10, sep=), paste(col, 1:5, sep=)))

Re: [R] randomForest importance problem with combine [Broadcast]

2007-07-24 Thread Liaw, Andy
I've been fixing some problems in the combine() function, but that's only for regression data. Looks like you are doing classification, and I don't see the problem: R library(randomForest) randomForest 4.5-19 Type rfNews() to see new features/changes/bug fixes. R set.seed(1) R rflist -

Re: [R] apply incompatible dimensions error

2007-07-24 Thread Gabor Grothendieck
Your apply is trying to take the correlations of the rows of mat1 with the columns of mat2 which, of course, does not work if they have different numbers of columns. I think you mean to take the correlations of the columns of mat1 with the columns of mat2. For example, to take the correlations of

[R] cor inside/outside a function has different output

2007-07-24 Thread Bernzweig, Bruce \(Consultant\)
I'm calculating correlations between two matrices mat1 - matrix(sample(1:500,25), ncol = 5, dimnames=list(paste(mat1row, 1:5, sep=), paste(mat1col, 1:5, sep=))) mat2 - matrix(sample(501:1000,25), ncol = 5, dimnames=list(paste(mat2row, 1:5, sep=), paste(mat2col, 1:5, sep=)))

Re: [R] apply incompatible dimensions error

2007-07-24 Thread Benilton Carvalho
are you positive that your function is doing what you expect it to do? it looks like you want something like: sapply(1:10, function(i) cor(mat1[i,], mat2[i,])) b On Jul 24, 2007, at 11:05 AM, Bernzweig, Bruce ((Consultant)) wrote: Hi, I've created the following two matrices (mat1 and mat2)

Re: [R] apply incompatible dimensions error

2007-07-24 Thread Bernzweig, Bruce \(Consultant\)
Thanks Gabor! You state that my apply is taking rows of mat1 with columns of mat2. Is this because I have the y=mat2 parameter? apply(mat1, 1, f, y=mat2) Actually, what I would like is to run the correlations on a row against row basis: mat1 row1 x mat2 row1, etc. Thanks again, - Bruce

Re: [R] apply incompatible dimensions error

2007-07-24 Thread Gabor Grothendieck
Then try this: cor(t(mat1), t(mat2)) Also note 1. the above implies that mat1 and mat2 must have the same number of columns since if x and y are vectors cor(x,y) only makes sense if they have the same length. 2. the usual convention is that variables are stored as columns andt that rows

Re: [R] apply incompatible dimensions error

2007-07-24 Thread Benilton Carvalho
that's garbor's suggestion then. sorry for the misunderstanding. :-) b On Jul 24, 2007, at 11:35 AM, Bernzweig, Bruce ((Consultant)) wrote: Thanks Benilton, I know what I want to do, just not sure how to do it using R. The help documentation is not very clear. What I am trying to do is

Re: [R] apply incompatible dimensions error

2007-07-24 Thread Bernzweig, Bruce \(Consultant\)
Thanks for the explanation. As for the rows/columns thing, the data I receive is given to me in that way. I currently read it in using read.csv. Is there a function I should look at that can take that and transpose it or should I just process the data first outside of R? Thanks, - Bruce

[R] Using lmer with huge amount of data

2007-07-24 Thread Gang Chen
Based on the examples I've seen in using statistical analysis packages such as lmer, it seems that people usually tabulate all the input data into one file with the first line indicating the variable names (or labels), and then read the file inside R. However, in my case I can't do that

Re: [R] cor inside/outside a function has different output

2007-07-24 Thread Bernzweig, Bruce \(Consultant\)
Sorry. I looked up t after writing the previous email and realized that was what I was looking for! -Original Message- From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 24, 2007 11:48 AM To: Bernzweig, Bruce (Consultant) Cc: r-help@stat.math.ethz.ch Subject: Re:

Re: [R] cor inside/outside a function has different output

2007-07-24 Thread Gabor Grothendieck
I think this is really answered already in my previous post but just in case try this: res1 - t(apply(mat1, 1, cor, t(mat2))) res2 - cor(t(mat1), t(mat2)) all.equal(res1, res2, check.attributes = FALSE) [1] TRUE On 7/24/07, Bernzweig, Bruce (Consultant) [EMAIL PROTECTED] wrote: I'm

[R] plotting a summary.rq object in using pkg quantreg

2007-07-24 Thread Jeff G.
Hello, I am having problems adjusting the plot output from the quantreg package. Anyone know what I'm doing wrong? For example (borrowing from the help files): plot(summary(rq(foodexp~income,tau = 1:49/50,data=engel)), nrow=1, ncol=2,alpha = .4, ols = TRUE, xlab=test) The alpha= parameter

Re: [R] Fitting exponential curve to data points

2007-07-24 Thread Dieter Menne
Andrew Clegg andrew.clegg at gmail.com writes: ... If I want to demonstrate that a non-linear curve fits better than an exponential, what's the best measure for that? Given that neither of nls() or optim() provide R-squared. To supplement Karl's comment, try Douglas Bates' (author of nls)

[R] crimtab related question

2007-07-24 Thread Jean lobry
Dear all, the dataset documented under ?crimtab was also used in: @article{TreloarAE1934, title = {The adequacy of {S}tudent's criterion of deviations in small sample means}, author = {Treloar, A.E. and Wilder, M.A.}, journal = {The Annals of Mathematical

[R] Obtaining summary of frequencies of value occurrences for a variable in a multivariate dataset.

2007-07-24 Thread Allan Kamau
Hi all, If the question below as been answered before I apologize for the posting. I would like to get the frequencies of occurrence of all values in a given variable in a multivariate dataset. In short for each variable (or field) a summary of values contained with in a value:frequency pair,

[R] Fitting the best line to the plot of distance vs. correlation matrix

2007-07-24 Thread Urmi Trivedi
Hi all, Thanks for your help in generating the matrix of distance vs correlation. I did it using plot(as.vector(as.matrix(cormat)), as.vector(as.matrix(distmat))) Now I want to quantitate the same. May be on linear regression or some other statistical functions. I have tried using linmod

[R] lme or gls prediction intervals

2007-07-24 Thread Martin Henry H. Stevens
Hi folks, I am trying to generate 95% confidence intervals for a gls model using predict.nlme with R version 2.5.1 (2007-06-27) . nlme: Linear and Nonlinear Mixed Effects Models. R package version 3.1-83. I have looked in help, and I can do it for lm and glm models, and I can generate

[R] x,y,z table to matrix with x as rows and y as columns

2007-07-24 Thread jiho
Hello all, I am sure I am missing something obvious but I cannot find the function I am looking for. I have a data frame with three columns: X, Y and Z, with X and Y being grid coordinates and Z the value associated with these coordinates. I want to transform this data frame in a matrix

Re: [R] plotting a summary.rq object in using pkg quantreg

2007-07-24 Thread roger koenker
Package questions to package maintainers please. The short answer is that your alpha = .4 parameter needs to be passed to summary not to plot. Try this: plot(summary(rq(foodexp~income,tau = 1:49/50,data=engel),alpha =. 4), nrow=1, ncol=2, ols = TRUE) A longer answer would involve a

[R] Calculating subsets of row pairs using somthing faster than a for loop.

2007-07-24 Thread Bernzweig, Bruce \(Consultant\)
Hi all, Situation: - I have two matrices each w/ 4 rows and 20 columns. mat1 - matrix(sample(1:500,80), ncol = 20, dimnames=list(paste(mat1row, 1:4, sep=), paste(mat1col, 1:20, sep=))) mat2 - matrix(sample(501:1000,80), ncol = 20,

Re: [R] apply incompatible dimensions error

2007-07-24 Thread Bernzweig, Bruce \(Consultant\)
Thanks Benilton, I know what I want to do, just not sure how to do it using R. The help documentation is not very clear. What I am trying to do is calculate correlations on a row against row basis: mat1 row1 x mat2 row1, mat1 row1 x mat2 row2, ... mat1 row1 x mat2 row-n, mat1 row-n, mat2 row-n

Re: [R] Computing the rank of a matrix.

2007-07-24 Thread Martin Maechler
RV == RAVI VARADHAN [EMAIL PROTECTED] on Sat, 07 Apr 2007 18:39:36 -0400 writes: this is a bit a late reply... better late than never RV Hi Martin, Hi Ravi, thanks for your research. RV I played a bit with rankMat. I will first state the RV

[R] quantreg behavior changes for N1000

2007-07-24 Thread Jeff G.
Hello again R-experts and novices (like me), This seems like a bug to me - or maybe it's intentional...can anyone confirm? Up to 1000 reps, summary() of a rq object gives different output and subtly different confidence interval estimates. ThanksJeff testx=runif(1200) testy=rnorm(1200,

Re: [R] quantreg behavior changes for N1000

2007-07-24 Thread roger koenker
When in doubt: RTFM -- Quoting from ?summary.rq se: specifies the method used to compute standard standard errors. There are currently five available methods: 1. 'rank' which produces confidence intervals for the estimated parameters by inverting a

[R] [R-pkgs] New package: pomp, inference for partially-observed Markov processes

2007-07-24 Thread Aaron King
To: [EMAIL PROTECTED] Subject: New package: pomp, inference for partially-observed Markov processes The new package 'pomp' is built around a very general realization of nonlinear partially-observed Markov processes (AKA state-space models, nonlinear stochastic dynamical systems). The user

[R] Renamig a factor

2007-07-24 Thread Agustin Lobo
Which is the proper way to rename a factor? If I do: test$Parc[test$Parc==OlÞrdola]-Olèrdola R complains that Warning message: invalid factor level, NAs generated in: `[-.factor`(`*tmp*`, test$Parc == OlÞrdola, value = Olèrdola) Thanks Agus -- Dr. Agustin Lobo Institut de Ciencies de la Terra

[R] Latent class analysis with ordinal manifest variables

2007-07-24 Thread Eduard Bonet
Hi, I need a package to run Latent Class Analysis with ordinal manifest variables but i have not found it. LCA is for dichotomous variables and poLCA is for nominal ones. Can anyone tell me where i can find such a package if it exists. Thanks. Eduard [[alternative HTML version

Re: [R] x,y,z table to matrix with x as rows and y as columns

2007-07-24 Thread Mark Lyman
jiho jo.irisson at gmail.com writes: Hello all, I am sure I am missing something obvious but I cannot find the function I am looking for. I have a data frame with three columns: X, Y and Z, with X and Y being grid coordinates and Z the value associated with these coordinates. I

[R] How to add circular text for a graph with concentric circles

2007-07-24 Thread sparandekar
Dear R experts, I am plotting the population of students who live in a city, and in successive circular bands made of the contiguous districts that surround the city. This is a stylized figure, where I specify the area of each successive circle based on the cumulative population of students. I

Re: [R] Using lmer with huge amount of data

2007-07-24 Thread Gang Chen
Thank you very much for the response, Prof. Ripley. I think I am missing something here: how do you make this 'huge' and 'gigantic'? You have not told us how many subjects you have, but in imaging experiments it is usually no more than 50 and often less. Usually we have 10-30

Re: [R] x,y,z table to matrix with x as rows and y as columns

2007-07-24 Thread Mark Lyman
I am sure I am missing something obvious but I cannot find the function I am looking for. I have a data frame with three columns: X, Y and Z, with X and Y being grid coordinates and Z the value associated with these coordinates. I want to transform this data frame in a matrix of Z

Re: [R] Renamig a factor

2007-07-24 Thread Henrique Dallazuanna
Try: levels(test$Parc)[levels(test$Parc)==OlÞrdola] - Olèrdola -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O On 24/07/07, Agustin Lobo [EMAIL PROTECTED] wrote: Which is the proper way to rename a factor? If I do: test$Parc[test$Parc==OlÞrdola]-Olèrdola R

[R] ggplot2 axis color

2007-07-24 Thread Felipe Carrillo
Hi: Does anyone have an idea on how to color the axis and labels using ggplot2? This is what I got: library(ggplot2) p - qplot(total_bill, tip, data = tips) NewPlot- p + geom_abline(slope=c(0.1,0.15,0.2), colour=c(red,blue,yellow),size=c(2,5,2)) NewPlot + geom_smooth(colour=green,

Re: [R] Calculating subsets of row pairs using somthing faster than a for loop.

2007-07-24 Thread Gabor Grothendieck
I doubt its any faster than using a loop but probably less code is: library(zoo) z1 - zoo(t(mat1)); z2 - zoo(t(mat2)) idx - 1:ncol(z1) out - rollapply(cbind(z1, z2), 11, by.column = FALSE, FUN = function(x) cor(x[,idx],x[,-idx])) will give you a 10 x 16 multivariate zoo series such that:

Re: [R] Obtaining summary of frequencies of value occurrences for a variable in a multivariate dataset.

2007-07-24 Thread Adaikalavan Ramasamy
The name of the table should give you the value. And if you have a matrix, you just need to convert it into a vector first. m - matrix( LETTERS[ c(1:3, 3:5, 2:4) ], nc=3 ) m [,1] [,2] [,3] [1,] A C B [2,] B D C [3,] C E D tb - table( as.vector(m) ) tb A B C D E 1 2 3 2 1

[R] Regression trees using Goodness-of-Split

2007-07-24 Thread Fiona Callaghan
Hi I have two questions: 1) I would like to know if there is a package in R that constructs a regression tree using the 'goodness-of-split' algorithm for survival analysis proposed by Le Blanc and Crowley (1993) (rather than the usual CART algorithm that uses within-node difference and impurity

Re: [R] ggplot2 axis color

2007-07-24 Thread hadley wickham
Hi Felipe, Looks like a bug! I'll try and get it fixed for the next version. In the meantime, you can read the last chapter of the ggplot book to see how to fix it with grid. Hadley On 7/24/07, Felipe Carrillo [EMAIL PROTECTED] wrote: Hi: Does anyone have an idea on how to color the axis

Re: [R] Using lmer with huge amount of data

2007-07-24 Thread Prof Brian Ripley
On Tue, 24 Jul 2007, Gang Chen wrote: Thank you very much for the response, Prof. Ripley. I think I am missing something here: how do you make this 'huge' and 'gigantic'? You have not told us how many subjects you have, but in imaging experiments it is usually no more than 50 and often

Re: [R] Computing the rank of a matrix.

2007-07-24 Thread Ravi Varadhan
Hi Martin, I just realized (courtesy: ?qr) that LAPACK=TRUE always gives full rank, no matter what the matrix and tolerance are. So, clearly my results using LAPACK=TRUE should be ignored. So, the real comparison is only between rankMat and qr(., LAPACK=FALSE)$rank. I can’t help but fell that

Re: [R] Using lmer with huge amount of data

2007-07-24 Thread Prof Brian Ripley
I think I am missing something here: how do you make this 'huge' and 'gigantic'? You have not told us how many subjects you have, but in imaging experiments it is usually no more than 50 and often less. For each subject you have 3 x 30,000 responses plus an age. That is under 1Mb of data per

Re: [R] crimtab related question

2007-07-24 Thread Mark Difford
Hi Jean, You haven't yet had a reply from an authoratitive source, so here is my tuppence worth to part of your enquiry. It's almost certain that the receiving box is a receptacle into which tags were placed after they had been drawn and the inscribed measurement noted down. Measurements on

Re: [R] crimtab related question

2007-07-24 Thread roger koenker
While on the subject of mechanical methods of statistical research I can't resist quoting Doob's (1997) Statistical Science interview: My system, complicated by my inaccurate typing, led to retyping material over and over, and for some time I had an electric drill on my desk, provided

[R] Passing equations as arguments

2007-07-24 Thread Anup Nandialath
Friends, I'm trying to pass an equation as an argument to a function. The idea is as follows. Let us say i write an independent function Ideal Situation: ifunc - function(x) { return((x*x)-2) } mainfunc - function(a,b) { evala - ifunc(a) evalb - ifunc(b) if (evalaevalb){return(evala)} else

Re: [R] Overlaying a single contour from a new data array in levelplot

2007-07-24 Thread Deepayan Sarkar
On 7/24/07, Jenny Barnes [EMAIL PROTECTED] wrote: Dear R-Help community, I am trying to overlay a single contour line over a correlation plot using levelplot in the lattice package. These are the two arrays: 1) a correlation plot over Africa - so each grid square is a different colour

Re: [R] Passing equations as arguments

2007-07-24 Thread jim holtman
Here is one possible solution: ifun - function(a, b, FUN){ evala - FUN(a) evalb - FUN(b) if (evala evalb) return(evala) else return(evalb) } ifun(1,2,function(x) (x*x) - 2) On 7/24/07, Anup Nandialath [EMAIL PROTECTED] wrote: Friends, I'm trying to pass an equation as an

Re: [R] aggregate.ts

2007-07-24 Thread Achim Zeileis
On Wed, 25 Jul 2007, laimonis wrote: Consider the following scrap of code: ...slightly modified to x1 - ts(1:24, start = c(2000, 10), freq = 12) x2 - ts(1:24, start = c(2000, 11), freq = 12) and then y1 - aggregate(x1, nfreq = 4) gives the desired result while y2 - aggregate(x2, nfreq

[R] aggregate.ts

2007-07-24 Thread laimonis
Consider the following scrap of code: x- ts(1:50,start=c(1,11),freq=12) y - aggregate(x,nfreq=4) c(y) [1] 6 15 24 33 42 51 60 69 78 87 96 105 114 123 132 141 y Error in rep.int(, start.pad) : invalid number of copies in rep.int() tsp(y) [1] 1.83 5.58 4.00 So we

[R] initalizing and checking validity of S4 classes

2007-07-24 Thread Bojanowski, M.J. (Michal)
Dear useRs and wizaRds, I am currently developing a set of functions using S4 classes. On the way I encountered the problem exemplified with the code below. For some reason the 'validity' method does not seem to work, i.e. does not check for errors in the specification of the slots of the

Re: [R] initalizing and checking validity of S4 classes

2007-07-24 Thread Martin Morgan
Hi Michal -- Add validObject to your initialize method: setMethod(initialize, someclass, + function(.Object, v=numeric(0), l=character(0)) + { + # strip the vector names + cv - v + cl - l + names(cv) - NULL + names(cl) - NULL + rval - .Object + [EMAIL PROTECTED] - cv

[R] question on using gl1ce from lasso2 package

2007-07-24 Thread Li Li
Hi, I tried several settings by using the family=gaussian in gl1ce, but none of them works. For the case glm can work. Here is the error message I got: glm(Petal.Width~Sepal.Length+Sepal.Width+Petal.Length ,data=iris,family=gaussian()) gl1ce(Petal.Width~Sepal.Length+Sepal.Width+Petal.Length