Re: [R] problems with mosaic plot

2010-12-15 Thread kiotoqq
thanks so much! grapphics.off() works! 2010/12/16 Michael Bibo-2 [via R] < ml-node+3090212-673909616-205...@n4.nabble.com > > kiotoqq googlemail.com> writes: > > > > > > > I'm pretty sure that I did everything right, but my R is just not drawing > the > > mosaicplot that I want, and there is al

Re: [R] predict.lm with new regressor names

2010-12-15 Thread Dennis Murphy
Hi: On Wed, Dec 15, 2010 at 10:05 PM, Anirban Mukherjee wrote: > Hi all, > > Suppose: > > y<-rnorm(100) > x1<-rnorm(100) > lm.yx<-lm(y~x1) > > To predict from a new data source, one can use: > > # works as expected > dum<-data.frame(x1=rnorm(200)) > predict(lm.yx, newdata=dum) > Yup. > > Suppos

[R] predict.lm with new regressor names

2010-12-15 Thread Anirban Mukherjee
Hi all, Suppose: y<-rnorm(100) x1<-rnorm(100) lm.yx<-lm(y~x1) To predict from a new data source, one can use: # works as expected dum<-data.frame(x1=rnorm(200)) predict(lm.yx, newdata=dum) Suppose lm.yx has been run and we have the lm object. And we have a dataframe that has columns that don't

Re: [R] predict.lm with new regressor names

2010-12-15 Thread Michael Bedward
Hi Anirban, You can do it like this... lm.foobar <- lm(foo ~ bar) some.data <- rnorm(200) predict(lm.foobar, newdata=list(bar=some.data)) Hope that helps. Michael On 16 December 2010 17:05, Anirban Mukherjee wrote: > Hi all, > > Suppose: > > y<-rnorm(100) > x1<-rnorm(100) > lm.yx<-lm(y~x1) >

[R] predict.lm with new regressor names

2010-12-15 Thread Anirban Mukherjee
Hi all, Suppose: y<-rnorm(100) x1<-rnorm(100) lm.yx<-lm(y~x1) To predict from a new data source, one can use: # works as expected dum<-data.frame(x1=rnorm(200)) predict(lm.yx, newdata=dum) Suppose lm.yx has been run and we have the lm object. And we have a dataframe that has columns that don't

[R] extracting IDs from topGO results

2010-12-15 Thread Paul Rigor
Hello, So I'm working on extracting IDs from a topGO result object. I have a list of terms ranked by p values. However, does the result object contain indices to the original list of gene ids per go term? The documentation was a bit unclear. Thanks, Paul _

Re: [R] Reg : null values in kmeans

2010-12-15 Thread William Dunlap
Have your tried something like the following? > # put some data to cluster in a data.frame > d <- data.frame(x1=log(1:50), x2=sqrt(1:50), x3=1/(1:50)) > # put NA's in rows 1 and 3 > d[1,1] <- d[3,3] <- NA > # cluster the non-NA rows > tmp <- kmeans(na.omit(d), 3) # 3 clusters > # add cluster id ve

Re: [R] Reg : null values in kmeans

2010-12-15 Thread raji sankaran
Hi Jannis, Thank you for answering my question. I saw the option called na.omit when i used nnet() and tried to classify Iris data with that. I wanted to know if there is a similar option available in kmeans which can omit or in some way consider the null/NA values and cluster the observations.C

[R] extracting IDs from topGO results

2010-12-15 Thread Paul Rigor
Hello, So I'm working on extracting IDs from a topGO result object. I have a list of terms ranked by p values. However, does the result object contain indices to the original list of gene ids per go term? The documentation was a bit unclear. Thanks, Paul _

Re: [R] problems with mosaic plot

2010-12-15 Thread Michael Bibo
kiotoqq googlemail.com> writes: > > > I'm pretty sure that I did everything right, but my R is just not drawing the > mosaicplot that I want, and there is also no error messege, looks like this > right now: > > mosaicplot(arthritis) > > mosaicplot(~ sex + treatment + improved, data = arthritis

Re: [R] Problems drawing a colored 'rug' in the Lattice 'densityplot'

2010-12-15 Thread Mark Dalphin
Thanks Phil, That is exactly what I was looking for. Regards, Mark Phil Spector wrote: Mark - If I understand what you want, it can be done with a custom panel function: mypanel = function(x,subscripts,groups,...){ panel.densityplot(x,plot.points=FALSE,groups=groups,subscripts=subscript

Re: [R] peak detection

2010-12-15 Thread Carl Witthoft
previously I wrote... THere's the peaks package which will do some peak detection, or 'peaks' in the simecol package. Or msc.peaks.find in caMassClass, I'm madly trying to remember what spectral package I found which has a tool similar to msextrema but returns a couple more useful lists d

Re: [R] NA matrix operation

2010-12-15 Thread Joshua Wiley
Hi Patrik, If speed is an issue, an easy way to go a bit faster using Dr. Spector's code is: wh = which(is.na(mat), arr.ind=TRUE) mat[wh] = colMeans(mat, na.rm=TRUE)[wh[,2]] using that method, I can replace the NA values with column means on a 3 x 1 matrix with ~ 1% of values missing in

[R] problems with mosaic plot

2010-12-15 Thread kiotoqq
I'm pretty sure that I did everything right, but my R is just not drawing the mosaicplot that I want, and there is also no error messege, looks like this right now: > mosaicplot(arthritis) > mosaicplot(~ sex + treatment + improved, data = arthritis, color = TRUE) > -- View this message in conte

Re: [R] Problems drawing a colored 'rug' in the Lattice 'densityplot'

2010-12-15 Thread Phil Spector
Mark - If I understand what you want, it can be done with a custom panel function: mypanel = function(x,subscripts,groups,...){ panel.densityplot(x,plot.points=FALSE,groups=groups,subscripts=subscripts,...) panel.rug(x,col=trellis.par.get('superpose.line')$col[groups[subscripts]]) } Then

[R] SELECTING VARIABLES FROM A DATA SHEET

2010-12-15 Thread mliugonzal
Hi, I know that the following question is a basic one,sorry in advance. My problem is that I have a data sheet with 80 variables which are unemployment rates of 80 countries. I call it as u1 to u80. Besides I have for the same countries their productivity rates. I want to do a kind of loop to selec

[R] Problems drawing a colored 'rug' in the Lattice 'densityplot'

2010-12-15 Thread Mark Dalphin
Hi All, I'm trying to add a 'rug' representation of my data to a plot created with densityplot(). While I can do this in the simple case, I can't do it properly when I include the "groups" argument. I have an example below. I am running a reasonably new version of R. print(sessionInfo()) R v

Re: [R] NA matrix operation

2010-12-15 Thread Phil Spector
Patrik - I don't know if it's the fastest, but, assuming your Matrix is called mat, this seems to work fairly quickly: wh = which(is.na(mat),arr.ind=TRUE) mat[wh] = apply(mat,2,mean,na.rm=TRUE)[wh[,2]] - Phil Spector

[R] Problems with the borders (High difficulty)

2010-12-15 Thread Barroso, Judit
Dear r-help members, Could any of you help me with this model, please? This model gives error when some value touch whatever border and I do not know how to correct it. The 80% of the seeds produced by a plant will fell into the parent cell, the 15% in the first ring according to the king movem

Re: [R] ebimage problems

2010-12-15 Thread Gregoire Pau
Dear Kraman, MagickCoreTerminus() has been present in ImageMagick for quite a long time. It seems likely that you're using a very old version of ImageMagick. Please install a newer one. Which versions of ImageMagick, R and EBImage are using ? Best regards, Greg --- Gregoire Pau EMBL Researc

Re: [R] Solution to differential equation

2010-12-15 Thread Ravi Varadhan
This integral is NOT easy. Your solution is wrong. You cannot integrate term-by-term when the polynomial is in the *denominator* as it is here. I am not sure if there is a closed-form solution to this. I remember you had posed a problem before that is only slightly different from this. Previ

[R] levelplot blocks size

2010-12-15 Thread jonathan
Hi, I am trying to produce a levelplot using the following: library(lattice) df <- read.table("data", sep="\t", header=TRUE) gr = levelplot(df$z ~ df$x * df$y, xlim=0:1000,ylim=0:1000,aspect="iso",col.regions=heat.colors) print(gr) The produced result is: http://dl.dropbox.com/u/25473/bigplot.

[R] NA matrix operation

2010-12-15 Thread patrik . waldmann
Dear All,   does anyone know which is the fastest way to replace NA values in a Matrix by their column mean? library(Matrix) mat Links: -- [1] http://www.ownit.se [[alternative HTML version deleted]] __

Re: [R] how to plot empirical distribution function?

2010-12-15 Thread kiotoqq
I got it so far, but dont know if its right: > x=c(120,40,75,85,55,75,55,90,90,55,155) > Fn <- ecdf(x) > plot(Fn,verticals = TRUE, ? > -- View this message in context: http://r.789695.n4.nabble.com/how-to-plot-empirical-distribution-function-tp3089821p3089845.html Sent from the R help mailing

[R] how to plot empirical distribution function?

2010-12-15 Thread kiotoqq
I have the table company: 1 2 3 4 5 6 7 8 9 10 11 transaction volume:120 40 75 85 55 75 55 90 90 55 155 how can I plot the empirical distribution function of it? I only know there is the ecdf, but I dont know how to use it, please help! -- View this message in context: http://r.789695.n4.nabble

Re: [R] selecting certain rows from data frame

2010-12-15 Thread Hrithik R
Hi Steven and Peter, I apologise for not providing the code for the sample I now realise what I need may be a bit tricky... my dataframe has hundreds of IDs in which case Steven's solution will not be optimum Peter's solution seems best, but how do I reverse this and use it to select the dataf

Re: [R] 300 dpi and eps:

2010-12-15 Thread Jeff Newmiller
You seem to be stuck on pixels and so forth. This should not be your concern. You should (as Joshua said) specify the aspect ratio by indicating the real dimensions of your graphic in your call to postscript (), but that image won't become pixels until later, and your publisher will be the one t

Re: [R] help with anova()

2010-12-15 Thread Peter Ehlers
On 2010-12-15 11:12, brianiphk wrote: I'm trying to run an ANOVA in R and I have a problem: I used this command: anova(lm(time~age*region*facility)) Age, region, and facility are all factor levels, which has 2, 4, and 3 levels respectively. however, in the output (anova table), it states that

Re: [R] Cumulative percentage by unit of time

2010-12-15 Thread Francois Rousseu
Hi Sebastien! How about this: d<-data.frame(nest,LD,FD) l<-apply(d,1,function(i){seq(i["LD"],i["FD"],by=1)}) jul<-60:273 active<-sapply(jul,function(i){sum(sapply(l,function(k){i %in% k}))}) ans<-data.frame(jul,perc_act=100*active/length(nest)) ans When you say cumulative percentage active,

Re: [R] Numbers in a string

2010-12-15 Thread Petr Savicky
On Wed, Dec 15, 2010 at 01:29:16PM -0500, David Winsemius wrote: > > On Dec 15, 2010, at 6:01 AM, Nick Sabbe wrote: > > >Hi Felipe, > > > >gsub("[^0123456789]", "", "AB15E9SDF654VKBN?dvb.65") > >results in "15965465". > >Would that be what you are looking for? > > > I tried figuring out how to

Re: [R] Cumulative percentage by unit of time

2010-12-15 Thread Phil Spector
Sebastien - Since you didn't provide a reproducible example, I may be off track, but here's how I'd handle the problem. Suppose the data set with nest_id, LD, and FD is called mydata. First create a function to find the percentage of active nests for a given time: pctact = function(time)10

Re: [R] subset

2010-12-15 Thread Silvano
Phil, this is exactly what do I want. Thanks a lot. -- Silvano Cesar da Costa Departamento de Estatística Universidade Estadual de Londrina Fone: 3371-4346 -- - Original Message - From: "Phil Spector" To: "Silvan

[R] help with anova()

2010-12-15 Thread brianiphk
I'm trying to run an ANOVA in R and I have a problem: I used this command: anova(lm(time~age*region*facility)) Age, region, and facility are all factor levels, which has 2, 4, and 3 levels respectively. however, in the output (anova table), it states that the df is 1 for all three factors, which

Re: [R] Help with RGL package problem

2010-12-15 Thread John Fox
Dear Duncan and David, For what it's worth I have no problem running rgl on R, R.app, or R64.app under Mac OS X 10.6.5. I'd suspect an X11 issue, though David says that's not the case. Best, John John Fox Senator William McMaster Professor of Social Statisti

[R] Cumulative percentage by unit of time

2010-12-15 Thread Sébastien Rioux
Hi All, I've been struggling on that one for a couple of days. I've tried several things, but nothing is worth publishing. I'm working with a bird nests data frame for which I have a laying date (LD) and a fledgling date (FD) (in calendar Julian date) by nest id. For the period spanning between L

Re: [R] subset

2010-12-15 Thread Phil Spector
Silvano - If you always have exactly one med1, one med2, and one med3 for each combination of Grupos, Dias, and Rato, you can use aggregate(Esp.Inter.Trac~Grupos+Dias+ Rato,mean,data=x) Grupos Dias Rato Esp.Inter.Trac 1 C31 100.55667 2 GFC31 87.62333

Re: [R] Applying function to a TABLE and also "apply, tapply, sapply etc"

2010-12-15 Thread Brian Diggs
On 12/15/2010 7:18 AM, Amelia Vettori wrote: Dear R-help forum members, Suppose I have a data-frame having two variables and single data for each of them, as described below. variable_1 variable_2 10 20 I have written a function, say, 'fun' which uses input

Re: [R] How to apitalize leading letters & else of personal names?

2010-12-15 Thread RockO
David, Thank you very much! Indeed Capitalizing names is very tricky, particularly for people not having English -mother language (as I am). Hopefully, Using your script will much better than simply having names in uppercase. Happy Holidays! Rock -- View this message in context: http://r.7896

Re: [R] 300 dpi and eps:

2010-12-15 Thread Joshua Wiley
Hi Aldi, Perhaps this will help slightly: Dots per inch (DPI) or points (pixels) per inch (PPI) = number of pixels/number of inches. there are several ways of specifying the size of a graphic in R. You use the "width" and "height" argument regardless, but you can set a third argument the "units

[R] Multinomial Analysis

2010-12-15 Thread soeren . vogel
I want to analyse data with an unordered, multi-level outcome variable, y. I am asking for the appropriate method (or R procedure) to use for this analysis. > N <- 500 > set.seed(1234) > data0 <- data.frame(y = as.factor(sample(LETTERS[1:3], N, repl = T, + prob = c(10, 12, 14))), x1 = sample

[R] subset

2010-12-15 Thread Silvano
Hi, I have a file, like below, and I want create a new data.frame with variables: Grupos Dias Rato Esp.Inter.Trac, but Esp.Inter.Trac will be the mean of med1 med2 and med3 for each Rato. How can I do this? Grupos Dias Rato blocos Esp.Inter.Trac GFC 31 med1 85.99 G

Re: [R] ebimage problems

2010-12-15 Thread Martin Morgan
On 12/15/2010 06:39 AM, kraman wrote: > > Hello, I've been having some trouble working with the aroma package and have > realized that it's my ebimage is at the root of the problem. The package > builds but during testing it fails because of an undefined symbol as seen > below: > > > > install

Re: [R] Help with RGL package problem

2010-12-15 Thread David A. Johnston
Thank you Joshua and Duncan for your very quick responses. Joshua, I will indeed read more about the OpenGL and GLU systems. Duncan, I am running R via a console. I also tried via the GUI R.app and the same problems with loading the package and opening a graphics device occurred. I find it

Re: [R] Can the by() function return a single column?

2010-12-15 Thread David Winsemius
On Dec 15, 2010, at 11:19 AM, Gerrit Eichner wrote: Hello, Vassilis, maybe with( test.df, ave( vector, factor, FUN = function( x) x - mean( x))) does what you want. THere is also the scale function which can be called with the parameters set to center but not scale the results: wit

Re: [R] Numbers in a string

2010-12-15 Thread David Winsemius
On Dec 15, 2010, at 6:01 AM, Nick Sabbe wrote: Hi Felipe, gsub("[^0123456789]", "", "AB15E9SDF654VKBN?dvb.65") results in "15965465". Would that be what you are looking for? I tried figuring out how to do this from a more positive perspective, meaning finding a regular expression function

Re: [R] 300 dpi and eps:

2010-12-15 Thread Aldi Kraja
Thank you Jeff for your advice, Maybe it was better my email subject to had been "high quality R graphs for publication" instead of "300 dpi and eps". a. In my latest response I was asking for any published paper/book (written by anybody in the R list) that describes how R handles vector grap

Re: [R] Help with RGL package problem

2010-12-15 Thread Joshua Wiley
Hi David, I had similar errors are linux awhile back. I ended up needing to install/update some of rgl's non-R dependencies. I want to say it was OpenGL and GLU in particular, but I was doing a lot of install/updating at the time and I may be mixing one or both of those up. Also that was linux,

Re: [R] Help with RGL package problem

2010-12-15 Thread Duncan Murdoch
On 15/12/2010 1:11 PM, David A. Johnston wrote: Hello, I have been experiencing an odd error with the RGL package that I cannot figure out. I have searched without luck for fixes to this problem on Rseek, Google, and the R-help-list. RGL used to work on my machine about a month ago. It was a

Re: [R] lmList and lapply(... lm) different std. errors

2010-12-15 Thread Dennis Murphy
Hi: On Wed, Dec 15, 2010 at 4:24 AM, beatlebg wrote: > > Am I trying to perform multiple linear regressions on each 'VARIABLE2'. I > figured out that there are different ways, using the following code: > (data > is given at the end of this message) > reg <- lapply(split(TRY, VARIABLE2), function

Re: [R] How to apitalize leading letters & else of personal names?

2010-12-15 Thread David Winsemius
On Dec 14, 2010, at 9:00 PM, RockO wrote: Dear R world, Do you know about a function that would capitalize in the correct manner first and family names? I found in the cwhmisc only the CapLeading function, but it just does not do the job, taking care only to capitalize the first letter

[R] Help with RGL package problem

2010-12-15 Thread David A. Johnston
Hello, I have been experiencing an odd error with the RGL package that I cannot figure out. I have searched without luck for fixes to this problem on Rseek, Google, and the R-help-list. RGL used to work on my machine about a month ago. It was a very useful tool. The graphics device will not i

Re: [R] Can the by() function return a single column?

2010-12-15 Thread Vassilis
Hi Gerrit, This does exactly what I want, thank you very much! Even more, I notice that ave() uses the split/unsplit functions under the hood, which are very useful tools as they allow to apply even more complicated functions on a factor-by-factor basis. best, Vassilis -- View this message

Re: [R] lattice fun: multiple themes in panels with spplot()

2010-12-15 Thread Neil Best
Now I have this: trellis.par.set( peelTheme) plot( spplot( thumbDf, "pri", main= "Primary cover", mapasp = "iso", colorkey= FALSE), panel.width= list( x=0.6, units= "npc"), split= c( 1, 1, 3, 1), position= c( 0, 0.2, 1, 0.8), more= TRUE

Re: [R] selecting certain rows from data frame

2010-12-15 Thread Peter Ehlers
On 2010-12-15 09:44, Hrithik R wrote: Hi Steven and Peter, I apologise for not providing the code for the sample I now realise what I need may be a bit tricky... my dataframe has hundreds of IDs in which case Steven's solution will not be optimum Peter's solution seems best, but how do I reverse

Re: [R] Applying function to a TABLE and also "apply, tapply, sapply etc"

2010-12-15 Thread Amelia Vettori
Dear Sir, Thanks for your reply. Sir, the function I have defined (i.e. addition) was just an indicative one. The function I have actually constructed is bit complex. Basically, I wish to learn how the same function can be applied to a dataframe where each row of the dataframe becomes new input

Re: [R] Solution to differential equation

2010-12-15 Thread Scionforbai
> I am trying to find the analytical solution to this differential equation > > dR/dt = k1*(R^k2)*(1-(R/Rmax)); R(0) = Ro > If there is an analytial solution to this differential equation then it It is a polynomial function of R, so just develop the expression and when you get the two terms in R

Re: [R] Solution to differential equation

2010-12-15 Thread Mike Marchywka
> Date: Wed, 15 Dec 2010 11:46:40 -0500 > From: msamt...@gmail.com > To: r-help@r-project.org > Subject: [R] Solution to differential equation > > Hello, > I am trying to find the analytical solution to this differential equation > > dR/dt = k1*(R^k2)*(

Re: [R] Installing R help files (2.11 or later) when no internet access.

2010-12-15 Thread peter dalgaard
On Dec 15, 2010, at 15:20 , gillian raab wrote: > We work on a secure stand-alone server with no internet access, for security > reasons. We are running Windows XP. SInce version 2.11 the R help files > point straight to the internet. Is there any way we could have a local help > that we coul

Re: [R] 300 dpi and eps:

2010-12-15 Thread Jeff Newmiller
It is possible to embed a raster image inside eps, but AFAIK R does not do this. Other than that, your questions do not apply to eps. Rendering resolution only comes into play when you put it into a raster software (like photoshop) or print it. Beyond that, we don't know what you are doing with

Re: [R] Installing R help files (2.11 or later) when no internet access.

2010-12-15 Thread Duncan Murdoch
On 15/12/2010 9:20 AM, gillian raab wrote: We work on a secure stand-alone server with no internet access, for security reasons. We are running Windows XP. SInce version 2.11 the R help files point straight to the internet. Is there any way we could have a local help that we could access on our

[R] Using Metafor package: how to backtransform model coefficients when Freeman Tukey double arcine transformation is used

2010-12-15 Thread Bruijning-Verhagen, P.C.J.L.
Hello, I am performing a meta-analysis using the metafor package. My data are proportions and I used the Freeman Tukey double arcine (FT) transformation to fit the random effects model. Now I want to create a forest plot with my estimates backtransformed to the original scale of proportions. Can t

[R] Installing R help files (2.11 or later) when no internet access.

2010-12-15 Thread gillian raab
We work on a secure stand-alone server with no internet access, for security reasons. We are running Windows XP. SInce version 2.11 the R help files point straight to the internet. Is there any way we could have a local help that we could access on our server. Thanks in advance for any soluti

[R] ebimage problems

2010-12-15 Thread kraman
Hello, I've been having some trouble working with the aroma package and have realized that it's my ebimage is at the root of the problem. The package builds but during testing it fails because of an undefined symbol as seen below: installing to /usr/local/lib64/R/library/EBImage/libs ** R **

Re: [R] Help about nlminb function

2010-12-15 Thread kamel gaanoun
Ooops, you're right Jonathan and Ben, the problem is with starting values the objective function evaluate to Inf, that's not normal. Thank you for this help, now I will try to rosolve this and tell you. Thanks a lot. 2010/12/15 Jonathan P Daily > Your function is evaluating to Inf

Re: [R] Help about nlminb function

2010-12-15 Thread Jonathan P Daily
Your function is evaluating to Inf. Is this expected behavior? I don't know what starting values you are using, but it looks like the initial values evaluate to Inf. If this is also true for values near your initial conditions then I am not surprised the optimization returns initial values. Tr

Re: [R] Problem with lme4 package

2010-12-15 Thread suchy
Perhaps I have installed R first and after it gfortran. Should I uninstall R and install once again? -- pozdrawiam / regards Tomasz Suchocki W dniu 15 grudnia 2010 12:54 użytkownik Łukasz Ręcławowicz [via R] napisał: > 2010/12/15 suchy <[hidden email]> > >> /usr/lib64/gcc/x86_64-suse-lin

Re: [R] selecting certain rows from data frame

2010-12-15 Thread Hrithik R
Hi Steven and Peter, I apologise for not providing the code for the sample I now realise what I need may be a bit tricky... my dataframe has hundreds of IDs in which case Steven's solution will not be optimum Peter's solution seems best, but how do I reverse this and use it to select the dataf

Re: [R] Solution to differential equation

2010-12-15 Thread Jeff Newmiller
ODEs don't get much easier than this... integration by parts is overkill. See the posting guide re homework. "mahesh samtani" wrote: >Hello, >I am trying to find the analytical solution to this differential >equation > >dR/dt = k1*(R^k2)*(1-(R/Rmax)); R(0) = Ro > >k1 and k2 are parameters th

Re: [R] Applying function to a TABLE and also "apply, tapply, sapply etc"

2010-12-15 Thread Seeliger . Curt
Amelia of Aukland writes: > Suppose instead of having above dataframe having single data for > variable 1 and variable 2, I have following data as > > variable_1 variable_2 > >10 20 > 40 30 > 3

[R] Solution to differential equation

2010-12-15 Thread mahesh samtani
Hello, I am trying to find the analytical solution to this differential equation dR/dt = k1*(R^k2)*(1-(R/Rmax)); R(0) = Ro k1 and k2 are parameters that need to fitted, while Ro and Rmax are the baseline and max value (which can be fitted or fixed). The response (R) increases initially at an exp

Re: [R] Applying function to a TABLE and also "apply, tapply, sapply etc"

2010-12-15 Thread Liviu Andronic
On Wed, Dec 15, 2010 at 4:18 PM, Amelia Vettori wrote: > Dear R-help forum members, > > Suppose I have a data-frame having two variables and single data for each of > them, as described below. > > variable_1   variable_2 >     10  20 > > I have written a functi

Re: [R] Can the by() function return a single column?

2010-12-15 Thread Gerrit Eichner
Hello, Vassilis, maybe with( test.df, ave( vector, factor, FUN = function( x) x - mean( x))) does what you want. -- Gerrit On Wed, 15 Dec 2010, Vassilis wrote: I would like to de-mean the 'vector' column of the following dataframe by factor: set.seed(5444) vector <- rnorm(1:10) facto

Re: [R] pmnorm: probabilites don't sum up to 1

2010-12-15 Thread Nicolas Berkowitsch
Hi Peter, Thx for your comment - I guess you're right... I made a drawing to better understand which quadrants overlap So I ende up with this Code: library(mnormt) # can handle multivariate normal distributions uX = 2 uY = 1 uZ = .5 mean = c(uX, uY, uZ) LX = matrix(c(1,-1,0,1,0,-1), 2, 3, b

Re: [R] 300 dpi and eps:

2010-12-15 Thread Aldi Kraja
I have come around several times from R to A. Illustrator, or A. photoshop, and between them with PowerPoint. It is possible that the last one I reported was from PowerPoint. So from your postings it was made clear that postscript plot from R produces a vector graph. Can someone recommend some

Re: [R] Structure of Anova for obtaining sig. corrected for departure from sphericity

2010-12-15 Thread John Fox
Dear dror, If I understand correctly what you want to do, the setup is similar to the O'Brien-Kaiser example in ?Anova, only simpler. First, you have to reorganize your data in "wide" format so that there's one record for each subject, with response variables (say) present.C and present.D. Then

[R] Can the by() function return a single column?

2010-12-15 Thread Vassilis
I would like to de-mean the 'vector' column of the following dataframe by factor: set.seed(5444) vector <- rnorm(1:10) factor <- rep(1:2,5) test.df <- data.frame(factor, vector) which is: factor vector 1 1 -0.4963935 2 2 -2.0768182 3 1 -1.584 4 2 0.8025474

[R] Applying function to a TABLE and also "apply, tapply, sapply etc"

2010-12-15 Thread Amelia Vettori
Dear R-help forum members, Suppose I have a data-frame having two variables and single data for each of them, as described below. variable_1   variable_2     10  20 I have written a function, say, 'fun' which uses input 10 and 20 and gives me desired result.

Re: [R] How to apitalize leading letters & else of personal names?

2010-12-15 Thread Ben Bolker
RockO gmail.com> writes: > > > Dear R world, > > Do you know about a function that would capitalize in the correct manner > first and family names? > I found in the cwhmisc only the CapLeading function, but it just does not do > the job, taking care only to capitalize the first letter of a wor

Re: [R] Help about nlminb function

2010-12-15 Thread Ben Bolker
kamel gaanoun gmail.com> writes: > > I appologize for the lack of information in my previous mail, but it is my > first one. > > Yes I red -in part- the Port documentation to learn what does the message > X-convergence (3) mean. > > so this is my nlminb and the results : > > res1<-nlminb(par

Re: [R] Help about nlminb function

2010-12-15 Thread kamel gaanoun
I appologize for the lack of information in my previous mail, but it is my first one. Yes I red -in part- the Port documentation to learn what does the message X-convergence (3) mean. so this is my nlminb and the results : res1<-nlminb(parametres[,3], V, lower=c(rep(0.01, 18), rep(0.01, 3), rep

Re: [R] Help about nlminb function

2010-12-15 Thread Jonathan P Daily
How are we supposed to help you if we have no idea how you are using it? Did you read the PORT documentation? Did you look at the control parameters outlined in the function help page? Often times for me a return of the initial conditions is an issue with either inappropriate tolerance or havin

Re: [R] calculating mean of list components

2010-12-15 Thread Liviu Andronic
On Wed, Dec 15, 2010 at 2:22 PM, Jim Maas wrote: > I get a list object from an iterative function.  I'm trying to figure out > the most efficient way to calculate the mean of one element, across all > components of the overall list. > > I've tried > > output <- mean (listobject[[1:5]]$element) > >

[R] Help about nlminb function

2010-12-15 Thread kamel gaanoun
Hi Everyone, Can anyone help me resolve a problem that i'm having with nlminb. The problem is that it stops after just one iteration and returns the same values as "start" ones. Thank you very much for your help. Sincerely. -- Kamel Gaanoun (+33) (0)6.76.04.65.77 [[alternative HT

Re: [R] calculating mean of list components

2010-12-15 Thread Henrique Dallazuanna
Try this: mean(unlist(sapply(listobject[1:5], '[', 'element'))) On Wed, Dec 15, 2010 at 11:22 AM, Jim Maas wrote: > I get a list object from an iterative function. I'm trying to figure out > the most efficient way to calculate the mean of one element, across all > components of the overall lis

[R] Odp: calculating mean of list components

2010-12-15 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 15.12.2010 14:22:15: > I get a list object from an iterative function. I'm trying to figure > out the most efficient way to calculate the mean of one element, across > all components of the overall list. > > I've tried > > output <- mean (listobject

[R] spatial clusters

2010-12-15 Thread dorina.lazar
Dear all, Roger, Georg, thanks a lot for your suggestions. I am working in R (time series…), but I am truly beginner in spatial statistics. How to create a shapefiles including my data about some socio-demographic indicators (7), for about 30 countries around the world? I know it is a stupid

[R] No fonts control on Cairo in batch mode

2010-12-15 Thread Christian Kamenik
Dear all, I am using Cairo version 1.4-5 for plotting R graphs on a Gentoo system that does not have X11 installed. I have full control on the fonts when running R in interactive mode. But when running R in batch mode I cannot change e.g. font size. Letters (including symbols) are, however, dr

[R] calculating mean of list components

2010-12-15 Thread Jim Maas
I get a list object from an iterative function. I'm trying to figure out the most efficient way to calculate the mean of one element, across all components of the overall list. I've tried output <- mean (listobject[[1:5]]$element) to get the mean of "element" in the first five components? I

Re: [R] survfit

2010-12-15 Thread Terry Therneau
> testpred Call: coxph(formula = Surv(time, status) ~ x, method = object$method) coef exp(coef) se(coef) zp karno -0.00756 0.992 0.0364 -0.208 0.84 Likelihood ratio test=0.89 on 1 df, p=0.344 n= 7 > newd1 <- list(testall$x[1,]) > survtest <- survfit(testpred,newdat

Re: [R] Numbers in a string

2010-12-15 Thread Petr Savicky
On Wed, Dec 15, 2010 at 11:08:06AM -0200, Henrique Dallazuanna wrote: > Try this: > > gsub("[^0-9]", "", "AB15E9SDF654VKBN?dvb.65") Consider also strsplit("AB15E9SDF654VKBN?dvb.65", "[^.0-9][^.0-9]*") [[1]] [1] """15" "9" "654" ".65" PS. > On Wed, Dec 15, 2010 at 6:55 AM, Luis Fe

Re: [R] Reg : null values in kmeans

2010-12-15 Thread Jannis
I do not really understand your question. You can use use kmeans but without the observations that include the NA values (e.g. by deleting whole rows in your observation matrix). If you want to keep the information in the valid observations of those rows, I fear you need to look for a clusterin

Re: [R] Numbers in a string

2010-12-15 Thread Henrique Dallazuanna
Try this: gsub("[^0-9]", "", "AB15E9SDF654VKBN?dvb.65") On Wed, Dec 15, 2010 at 6:55 AM, Luis Felipe Parra < felipe.pa...@quantil.com.co> wrote: > Hello, I have stings which have all sort of characters (numbers, letters, > punctuation marks, etc) I would like to stay only with the numbers in th

Re: [R] pmnorm: probabilites don't sum up to 1

2010-12-15 Thread peter dalgaard
On Dec 15, 2010, at 11:40 , Nicolas Berkowitsch wrote: > Dear list member, > > I struggle with the problem, why the probabilities of choosing one of three > mutually exclusive alternatives don?t sum up to 1! > > Let?s assume we have three alternatives X, Y, and Z. Let?s further assume we > kn

Re: [R] Installing R-packages in Windows

2010-12-15 Thread Uwe Ligges
On 14.12.2010 23:48, Erik Lukac wrote: Hi Mike, Hi Uwe, thanks for your reply. The main thing is that we have mixed OSs. On the one hand we have Linux, on the other WinXP. I need the same version of packages and R on both systems. Otherwise I cant explain my colleagues why error messages are r

[R] lmList and lapply(... lm) different std. errors

2010-12-15 Thread beatlebg
Am I trying to perform multiple linear regressions on each 'VARIABLE2'. I figured out that there are different ways, using the following code: (data is given at the end of this message) reg <- lapply(split(TRY, VARIABLE2), function(X){lm(X2 ~ X3, data=X)}) lapply(reg, summary) Which produces

Re: [R] selecting certain rows from data frame

2010-12-15 Thread David Winsemius
On Dec 15, 2010, at 4:18 AM, Ivan Calandra wrote: Hi, Just to note that which() is unnecessary here: DF2 <- DF[DF$ID==2 | DF$ID==5, ] And to further note that it is only unnecessary of you have no NA's in that ID column. > DF[4,1] <- NA > DF[8,1] <- NA > DF2 <- DF[DF$ID==2 | DF$ID==5, ]

Re: [R] Problem with lme4 package

2010-12-15 Thread Łukasz Ręcławowicz
2010/12/15 suchy > /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: > cannot find -lgfortran > collect2: ld returned 1 exit status > Similar situation I have for other packages. > > Could You help me? > > Did you install gfortran first? -- Mi³ego dnia [[alte

Re: [R] Numbers in a string

2010-12-15 Thread Nick Sabbe
Hi Felipe, gsub("[^0123456789]", "", "AB15E9SDF654VKBN?dvb.65") results in "15965465". Would that be what you are looking for? Nick Sabbe -- ping: nick.sa...@ugent.be link: http://biomath.ugent.be wink: A1.056, Coupure Links 653, 9000 Gent ring: 09/264.59.36 -- Do Not Disapprove -Origin

[R] Structure of Anova for obtaining sig. corrected for departure from sphericity

2010-12-15 Thread Dror D Lev
Dear helpers, I have a 2x2 mixed design with two "groups" (between-subjects) and two presentation-types (within-subjects). The difference between groups is in the order of manipulations: group.CD having first a block of present.type.C and then a block of present.type.D, each block containing 31 t

Re: [R] Why do we have to turn factors into characters for various functions?

2010-12-15 Thread Petr PIKAL
Hi Heinz OK, Point taken. I must say I do not do concatenation of factors very often so this feature does not bothers me much. Best regards Petr Heinz Tuechler napsal dne 13.12.2010 13:52:17: > Hello Petr, > > don't want to convince you. If you like the following: > > x <- factor(1:4, labe

  1   2   >