Re: [R] cbind formula definition

2009-09-09 Thread Biedermann, Jürgen
Hi Henrique, Thanks for your reply. I tried you suggestion but it didn't work with the poLCA package. Maybe i didn't express myself good. The normal syntax is: f - cbind(V1,V2,V3)~1 poLCA(f,data) and what I wanna do is kind of use an expression to automatically generate the V1,V2,V3 argument

Re: [R] cbind formula definition

2009-09-09 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 09.09.2009 10:07:49: Hi Henrique, Thanks for your reply. I tried you suggestion but it didn't work with the poLCA package. Maybe i didn't express myself good. The normal syntax is: f - cbind(V1,V2,V3)~1 poLCA(f,data) You complicated it a

Re: [R] eps file with embedded font

2009-09-09 Thread simone gabbriellini
Hi Paul, I've tried your solutions and it works great... still my eps viewer (CocoViewX) doesn't visualize them well, but the pdf converter (I use mac, the Finder does this conversion automagically) visualize all the images correctly thank you very much for your help! simone Il giorno

[R] change character to factor in data frame

2009-09-09 Thread Petr PIKAL
Dear all I have a simple problem which I thought is easy to solve but what I tried did not work. I want to change character variables to factor in data frame. It goes easily from factor to character, but I am stuck in how to do backwards conversion. Here is an example irisf-iris

[R] Forecast - How to create variables with summary() results parameters

2009-09-09 Thread Pedro Souto
Hi, I would like to create variables in R containing parameters of summary(*Forecast Results*). Using the following code: library(forecast) data - AirPassengers xets - ets(data, model=ZZZ, damped=NULL) xfor - forecast(xets,h=12, level=c(80,95)) summary(xfor) the output is: Forecast method:

Re: [R] cbind formula definition

2009-09-09 Thread Biedermann, Jürgen
Super! It works. :-) Thanks a lot, you both. Greetings Jürgen Petr PIKAL schrieb: Hi r-help-boun...@r-project.org napsal dne 09.09.2009 10:07:49: Hi Henrique, Thanks for your reply. I tried you suggestion but it didn't work with the poLCA package. Maybe i didn't express myself

[R] How to sum and group data by DATE in data frame

2009-09-09 Thread clair.crossup...@googlemail.com
Dear all, Lets say I have a data frame as follows: Date - as.Date(c('2006-08-23', '2006-08-30', '2006-09-06', '2006-09-13', '2006-09-20')) Income - c(73.79, 72.46, 76.32, 72.43, 72.62) data.frame(Date, Income) Date Income 1 2006-08-23 73.79 2 2006-08-30 72.46 3 2006-09-06 76.32

Re: [R] How to sum and group data by DATE in data frame

2009-09-09 Thread Mohamed Lajnef
Hi Clair, try to use this code aggregate(toto$Income,by=list((substr(toto$Date,1,7))),sum) Regards mohamed clair.crossup...@googlemail.com a écrit : Dear all, Lets say I have a data frame as follows: Date - as.Date(c('2006-08-23', '2006-08-30', '2006-09-06', '2006-09-13',

Re: [R] Derivative of nonparametric curve

2009-09-09 Thread Liaw, Andy
From: Rolf Turner On 8/09/2009, at 9:07 PM, FMH wrote: Dear All, I'm looking for a way on computing the derivative of first and second order of a smoothing curve produced by a nonprametric regression. For instance, if we run the R script below, a smooth nonparametric

Re: [R] How to sum and group data by DATE in data frame

2009-09-09 Thread Henrique Dallazuanna
Try this: rowsum(Income, format(Date, '%m-%Y')) or tapply(Income, format(Date, '%m-%Y'), sum) On Wed, Sep 9, 2009 at 7:51 AM, clair.crossup...@googlemail.com clair.crossup...@googlemail.com wrote: Dear all, Lets say I have a data frame as follows: Date - as.Date(c('2006-08-23',

Re: [R] Help with data containing date

2009-09-09 Thread Gabor Grothendieck
Just one other addition. If by monthly summary you mean a summary that has an entry for each year/month combo rather than just one entry for all Januaries, one entry for all Februaries etc. then try this which works in both the Date and chron cases: aggregate(z, as.yearmon, mean) On Tue, Sep

[R] Problem with print()

2009-09-09 Thread Amparo Albalate
Dear R-users, I´m having for the first time a problem while printing out values in the screen, I have a function wich takes quite a long time to execute, and I thought it´d be useful to insert a print statement inside the main loop to keep control of the current iteration, however, for some

[R] gridlines in contour plot

2009-09-09 Thread FMH
Dear All, Someone suggesting me to use the filled.contour function to plot the image together with the color index, and an example from the help menu is show below.   # require(grDevices) # for colours

Re: [R] Very basic question regarding plot.Design...

2009-09-09 Thread Petar Milin
Thank you very much for the help! Now, I have an additional question regarding transcending from Design to rms: Before, it was possible to plot interaction, and get lines with plot(ols2, gender=NA, marital.status=NA, xlab='gender', ylab='anxiety', conf.int=FALSE) Now, I am lost how to do

Re: [R] Forecast - How to create variables with summary() results parameters

2009-09-09 Thread Henrique Dallazuanna
Try this: accuracy(xfor) The model information can be obtained by: xfor$model On Wed, Sep 9, 2009 at 8:11 AM, Pedro Souto pmmso...@gmail.com wrote: Hi, I would like to create variables in R containing parameters of summary(*Forecast Results*). Using the following code:

Re: [R] gstat---2 basic plot questions

2009-09-09 Thread ONKELINX, Thierry
Dear Steve, Here are a fex examples for empirical variograms using ggplot2 library(gstat) library(ggplot2) data(meuse) coordinates(meuse) = ~x+y vgIso - variogram(log(zinc)~x+y, meuse) vgIso$id - iso vgAniso - variogram(log(zinc)~x+y, meuse, alpha=c(0,45,90,135)) vgAniso$id - aniso Empirical -

Re: [R] change character to factor in data frame

2009-09-09 Thread Henrique Dallazuanna
You could use lapply indeed of sapply: irisf[,index] - lapply(irisf[,index], as.factor) str(irisf) On Wed, Sep 9, 2009 at 8:06 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Dear all I have a simple problem which I thought is easy to solve but what I tried did not work. I want to change

[R] Facing an error during SVM prediction

2009-09-09 Thread Abbas R. Ali
Hi I am facing an error after using ksvm() and/or svm() when I can call predict() it is giving me the error: Error in .local(object, ...) : test vector does not match model ! My dimentions of trainingset is 134 x 95 and validationset is 66 x 94 sample code of prediction: model.ksvm =

Re: [R] Problem with print()

2009-09-09 Thread Henrique Dallazuanna
See ?flush.console for (i in 1:1e2){ print(i) flush.console() } On Wed, Sep 9, 2009 at 7:28 AM, Amparo Albalate amparo.albal...@uni-ulm.dewrote: Dear R-users, I惴 having for the first time a problem while printing out values in the screen, I have a function wich takes quite a long

Re: [R] Problem with print()

2009-09-09 Thread jim holtman
If you are running with RGUI, change the mode to nonbuffered output under the Misc tab or use flush.console() On Wed, Sep 9, 2009 at 6:28 AM, Amparo Albalateamparo.albal...@uni-ulm.de wrote: Dear R-users, I惴 having for the first time a problem while printing out values in the screen, I have a

[R] predict-fuction for metaMDS (vegan)

2009-09-09 Thread Kim Vanselow
Dear r-Community, Step1: I would like to calculate a NMDS (package vegan, function metaMDS) with species data. Step2: Then I want to plot environmental variables over it, using function envfit. The Problem: One of these environmental variables is cos(EXPOSURE). But for flat releves there is no

Re: [R] R-help Digest, Vol 79, Issue 9

2009-09-09 Thread Ista Zahn
From: Carlos Alzola calz...@cox.net To: r-help@r-project.org Date: Tue, 8 Sep 2009 23:19:11 -0400 Subject: [R] SAS vs. R in web application Good evening, I have been asked to investigate the pros and cons of using SAS vs. R in a web application. Either SAS or R would be the engine used to

Re: [R] Very basic question regarding plot.Design...

2009-09-09 Thread Frank E Harrell Jr
Petar Milin wrote: Thank you very much for the help! Now, I have an additional question regarding transcending from Design to rms: Before, it was possible to plot interaction, and get lines with plot(ols2, gender=NA, marital.status=NA, xlab='gender', ylab='anxiety', conf.int=FALSE) Now,

Re: [R] SRS Required sample size for simulated data

2009-09-09 Thread Robert Baer
My guess is that by table you are really looking for a 'dataframe'. Further, I guess that an indexed format is most useful to you. Try: # Create the requested dataframe dat=data.frame(type=c(rep(Hypermarket,10),rep(Supermarket,15),rep(Minimarket,20),rep(Cornershop,20),rep(Spazashop,35)),

Re: [R] predict-fuction for metaMDS (vegan)

2009-09-09 Thread Gavin Simpson
On Wed, 2009-09-09 at 14:43 +0200, Kim Vanselow wrote: Dear r-Community, Step1: I would like to calculate a NMDS (package vegan, function metaMDS) with species data. Step2: Then I want to plot environmental variables over it, using function envfit. The Problem: One of these environmental

Re: [R] How to reduce memory demands in a function?

2009-09-09 Thread Richard Gunton
Dear Jim, Thanks for telling me about gc() - that may help. Here's some more detail on my function. It's to implement a methodology for classifying plant communities into functional groups according to the values of species traits, and comparing the usefulness of alternative classifications

[R] Matrix multiplication and random numbers

2009-09-09 Thread RFish
Dear All I new to using R and am struggling with some matrix multiplication. I have two matrices, one containing random numbers, these are multiplied together to get another matrix which is different each time. When I put in another for loop to repeat this process a multiple times the matrices

Re: [R] Derivative of nonparametric curve

2009-09-09 Thread spencerg
This may be overkill for your application, but you might be interested in the fda package, for which a new book appeared a couple of months ago: Functional Data Analysis with R and Matlab (Springer Use R! series, by Ramsay, Hooker and Graves; I'm the third author). The package includes

Re: [R] How to reduce memory demands in a function?

2009-09-09 Thread jim holtman
If it is taking 10 hours to run, you might want to use Rprof on a small subset to see where time is being spent. Also can you use matrices instead of dataframe because there is a cost in accessing them if you are just using them in a matrix-like way. Take a look at the output from Rprof and that

Re: [R] Matrix multiplication and random numbers

2009-09-09 Thread jim holtman
I am not sure what you mean by being the same each time. If I make successive calls to the function, I get different results: z [,1] [1,] 0. [2,] 0. [3,] 201.6382 [4,] 0. [5,] 0. [6,] 0. [7,] 0. matmult(InitialPop,1) [,1] [1,] 0.000 [2,]

Re: [R] barplot with lines instead of bars

2009-09-09 Thread John Kane
A clumsy way but it seems to work data - data.frame(cbind(k = 0:3, fk = c(11, 20,7,2), f0k = c(13.72, 17.64, 7.56, 1.08), fkest = c(11.85, 17.78, 8.89, 1.48))) d - t(data[,2:4]) # barplot(d, beside=TRUE) xps1 - xps2 -

Re: [R] predict-fuction for metaMDS (vegan)

2009-09-09 Thread Dylan Beaudette
On Wed, Sep 9, 2009 at 5:43 AM, Kim Vanselowvanse...@gmx.de wrote: Dear r-Community, Step1: I would like to calculate a NMDS (package vegan, function metaMDS) with species data. Step2: Then I want to plot environmental variables over it, using function envfit. The Problem: One of these

Re: [R] Scan and read.table

2009-09-09 Thread Juliet Hannah
Do you run into problems if you use something like: cc - rep(numeric,9) mydata - read.table(yourdata,header=TRUE,colClasses=cc,skip=1,nrows=numRows) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] strange results in summary and IQR functions

2009-09-09 Thread John Kane
Have a look at ?IQR Note that this function computes the quartiles using the quantile function rather than following Tukey's recommendations, i.e., IQR(x) = quantile(x,3/4) - quantile(x,1/4). It looks like boxplot() gives the results you expect. tt - boxplot(x) tt --- On Tue,

Re: [R] Help-R-graphic

2009-09-09 Thread Arif Chandra
I am Arif. I have made program code for Vector Auto Regressive in terms of completing my undergraduate program using R. I have an important question related to my project. If I have: data(Canada) var.2c - VAR(Canada, p = 2, type = const) var.2c.stabil - stability(var.2c,

[R] weird vector size cannot be NA/NaN problem

2009-09-09 Thread Werner Wernersen
Hi, I have a weird problem with my data but I cannot really locate it and cannot make a small example data set do reproduce the problem. I basically divide one numerical column of a data frame with another. When I run describe() on that column, I get Error in vector(integer, length) : vector

Re: [R] Very basic question regarding plot.Design...

2009-09-09 Thread Petar Milin
Sorry, I hope this will be the last (for now, at least). Following your advices, I did: n - 100 anxiety - c(rnorm(n, 10, 2.5), rnorm(n, 26, 3.2), rnorm(100, 25, 3.1), rnorm(100, 10, 2.6)) m.status - c(rep('married', n*2), rep('not married', n*2)) gender - c(rep('male', n), rep('female',

[R] ggplot2: mixing colour and linetype in geom_line

2009-09-09 Thread Benoit Boulinguiez
Hi all, I try to represent a multiple curve graphic where the x-axis is the temperature and the different y-axes are the different X (X22,X43,X44...) some X corresponds to the same molecule (22 and 44 are for CO2 for instance) so I use the same colour for them. I wanna mix the linetype with

[R] more efficient vectorization of a function ?

2009-09-09 Thread Carlos Hernandez
dear All, i'm using the following two functions: share.vector - function (vec1) { vec1 - vec1 - max(vec1,na.rm=TRUE) -0.1 ## this line avoids overflow vec1 - exp(vec1) vec2 - vec1/(1+sum(vec1,na.rm=TRUE)) vec2 } share.matrix - function (mat1) { out1 - apply(mat1,2,share.vector)

Re: [R] barplot with lines instead of bars

2009-09-09 Thread S Ellison
What is wrong with using plot(..., type=h)? data - data.frame(cbind(k = 0:3, fk = c(11, 20,7,2), f0k = c(13.72, 17.64, 7.56, 1.08), fkest = c(11.85, 17.78, 8.89, 1.48))) d - t(data[,2:4]) plot(rep(1:4,3)+rep(seq(-0.1,0.1,0.1), 4), as.vector(d), col=rep(1:3, each=4),type=h, lwd=3,

Re: [R] Very basic question regarding plot.Design...

2009-09-09 Thread Frank E Harrell Jr
Petar Milin wrote: Sorry, I hope this will be the last (for now, at least). Following your advices, I did: n - 100 anxiety - c(rnorm(n, 10, 2.5), rnorm(n, 26, 3.2), rnorm(100, 25, 3.1), rnorm(100, 10, 2.6)) m.status - c(rep('married', n*2), rep('not married', n*2)) gender - c(rep('male',

Re: [R] optim() argument scoping: passing parameter values into user's subfunction

2009-09-09 Thread Bert Gunter
Inline below. Bert Gunter Genentech Nonclinical Biostatistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Ben Bolker Sent: Tuesday, September 08, 2009 7:29 PM To: r-help@r-project.org Subject: Re: [R] optim() argument scoping:

Re: [R] Matrix multiplication and random numbers

2009-09-09 Thread Chris Stubben
RFish wrote: I new to using R and am struggling with some matrix multiplication. I'm not sure what you're trying to print, but you could place this vector in an expression

Re: [R] barplot with lines instead of bars

2009-09-09 Thread John Kane
My bad memory? I forgot that option existed. --- On Wed, 9/9/09, S Ellison s.elli...@lgc.co.uk wrote: From: S Ellison s.elli...@lgc.co.uk Subject: Re: [R] barplot with lines instead of bars To: r-help@r-project.org, John Kane jrkrid...@yahoo.ca Received: Wednesday, September 9, 2009, 12:02

Re: [R] vector of Vectors

2009-09-09 Thread Giovanni Petris
The code below seems to contradict your claim that vectors cannot contain vectors. zz - vector(mode = list, length = 3) zz [[1]] NULL [[2]] NULL [[3]] NULL Best, Giovanni Date: Tue, 08 Sep 2009 23:00:54 -0500 (CDT) From: sclar...@illinois.edu Sender: r-help-boun...@r-project.org

Re: [R] (no subject)

2009-09-09 Thread Jari Oksanen
Hello Kim Gav, Gavin Simpson gavin.simpson at ucl.ac.uk writes: On Wed, 2009-09-09 at 14:43 +0200, Kim Vanselow wrote: Dear r-Community, Step1: I would like to calculate a NMDS (package vegan, function metaMDS) with species data. Step2: Then I want to plot environmental variables

Re: [R] Matrix multiplication and random numbers

2009-09-09 Thread RFish
Sorry I probably wasn't clear with my description. The reason i put for loop in was that I want to do the matrix multiplication about 1000 times to get a 1000 different matrices. Therefore I was hoping the for loop would be able to automate this then use write.table to write to an external

[R] R code for creating and appending to frequency table

2009-09-09 Thread drlucyasher
Apologies for what might seem like an simple question. I have written a model which gives me a frequency distribution for a particular score within a set. What I now want to do is loop this so that I get many different frequency distributions and append them to a table with a collum which

[R] lag a data.frame column?

2009-09-09 Thread Mark Knecht
Sometimes it's the simple things... Why doesn't this lag X$x by 3 and place it in X$x1? (i.e. - Na's in the first 3 rows and then values showing up...) The help page does talk about time series. If lag doesn't work on data.frame columns then what would be the right function to use to lag by a

Re: [R] R code for creating and appending to frequency table

2009-09-09 Thread jim holtman
If the result of the 'table' is a different length each time, then you will have to consider the use of a list. If it is the same length, then something like this should work results - matrix(ncol=50, nr=10) for (i in 1:50) results[,i] - your computation for table On Wed, Sep 9, 2009 at 12:40

Re: [R] lag a data.frame column?

2009-09-09 Thread Achim Zeileis
On Wed, 9 Sep 2009, Mark Knecht wrote: Sometimes it's the simple things... Why doesn't this lag X$x by 3 and place it in X$x1? It does. (i.e. - Na's in the first 3 rows and then values showing up...) Because this is not how the ts class handles lags. What happens is that X$x is

Re: [R] lag a data.frame column?

2009-09-09 Thread Gabor Grothendieck
Try this: x - 1:10 head(c(rep(NA, 3), x), -3) [1] NA NA NA 1 2 3 4 5 6 7 tail(c(x, rep(NA, 3)), -3) [1] 4 5 6 7 8 9 10 NA NA NA depending on which direction you want. On Wed, Sep 9, 2009 at 1:43 PM, Mark Knecht markkne...@gmail.com wrote: Sometimes it's the simple things...

[R] fitting nonlinear model

2009-09-09 Thread Bill Hyman
I only have 4 data points and want to fit a curve. It does not work in modreg due to too few data. Do you have any idea? Many thanks! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] fitting nonlinear model

2009-09-09 Thread Bill Hyman
My data look like: Np year 962 915 897 85 10 - Original Message From: Bill Hyman billhym...@yahoo.com To: r-help@r-project.org Sent: Wednesday, September 9, 2009 11:23:26 AM Subject: [R] fitting nonlinear model I only have 4 data points and want to fit a curve. It does

Re: [R] Writing R Scripts and passing command line arguments

2009-09-09 Thread Abhishek Pratap
Hi All Thanks for the pointers. reading them I see that what I intend to can certainly be done without much pain. However with my test scripts I am not able to fully understand Rscript. The ?Rscript option doesnt print out a lot to help me get the minute details. Any good example/s or some info

Re: [R] ggplot2: mixing colour and linetype in geom_line

2009-09-09 Thread Felipe Carrillo
Is this what you want? x - structure(list(Temp = c(25.9765, 26.57025, 27.164, 27.7565, 28.34892, 28.94142, 29.53125, 30.12233, 30.71483, 31.30983, 31.90233, 32.49475, 33.08458, 33.67575, 34.26558, 34.85933, 35.45183, 36.04683, 36.63933, 37.23042, 37.82417, 38.414), X22 = c(4.62e-12, 4.73e-12,

Re: [R] eps file with embedded font

2009-09-09 Thread Ted Harding
Thanks, Paul. In fact I had been hoping to lure you to the surface, from the 12740-km ocean depths which you inhabit, during our hours of darkness! Your suggested modification of the options in the embedFonts command indeed produces an EPS file which displays without clipping. However, when

Re: [R] Writing R Scripts and passing command line arguments

2009-09-09 Thread Gabor Grothendieck
Put this line in a file called test.R: cat(command args are:\n); print(commandArgs()) and then call it like this from the shell or Windows cmd line assuming that Rscript is in your path: Rscript test.R abc def On Wed, Sep 9, 2009 at 2:37 PM, Abhishek Pratap abhishek@gmail.com wrote: Hi

Re: [R] fitting nonlinear model

2009-09-09 Thread cls59
Bill Hyman wrote: My data look like: Np year 962 915 897 85 10 And which equation are you trying to fit to this data? -Charlie - Charlie Sharpsteen Undergraduate Environmental Resources Engineering Humboldt State University -- View this message in context:

Re: [R] fitting nonlinear model

2009-09-09 Thread milton ruser
Hi Bill, I am not sure what you want, but... mydf-read.table(stdin(), head=T, sep=,) Np,year 96,2 91,5 89,7 85,10 plot(Np~year, data=mydf) mymodel-lm(Np~year, data=mydf) abline(mymodel, col=red) bests milton On Wed, Sep 9, 2009 at 2:27 PM, Bill Hyman billhym...@yahoo.com wrote: My data look

Re: [R] fitting nonlinear model

2009-09-09 Thread Bill Hyman
Hi Milton, Thanks for your help. Actually, I would like to fit a non-linear fashion. For some data like below, 'lm' may not work very well. Do you have idea? Thanks again! Bill 0 1 2 0.9 5 0.5 7 0.1 10 0.01 From: milton ruser milton.ru...@gmail.com

[R] How to return/show the indexes of unusual points in boxplot?

2009-09-09 Thread guox
I am wondering if you know how to return by function or show in boxplot, the indexes of unusual points, such as, points that are outside the box or in [Q3+1.5IQR,Max]. For example, boxplot(c(4,rnorm(20),8)) There are 2 unusual points 4 and 8. How to show the indexes of 4 and 8 in the boxplot or

Re: [R] fitting nonlinear model

2009-09-09 Thread cls59
Bill Hyman wrote: Hi Milton, Thanks for your help. Actually, I would like to fit a non-linear fashion. For some data like below, 'lm' may not work very well. Do you have idea? Thanks again! That's why information equation you are trying to fit is very important. For example, the

[R] The code behind the function

2009-09-09 Thread Chunhao Tu
Hi R users, I have a question. How can I see the code behind the function. For example, boxplot function (x, ...) UseMethod(boxplot) environment: namespace:graphics I really would like to see how people code this. Could someone please show me how to see the code behind the function? Many

Re: [R] fitting nonlinear model

2009-09-09 Thread milton ruser
May be this: mydf-read.table(stdin(), head=T, sep=,) Xvar,Yvar 0,1 2,0.9 5,0.5 7,0.1 10,0.01 mymodel-loess(Yvar~Xvar, data=mydf) plot(mymodel) mydf.new-data.frame(cbind(Xvar=seq(from=0, to=10, by=0.1))) mydf.new$Yvar-predict(mymodel, newdata=mydf.new) lines(Yvar~Xvar, data=mydf.new, lty=2)

Re: [R] Combining simulated data

2009-09-09 Thread Schalk Heunis
Kabeli I think this is what you want: Hypermarket - matrix(rnorm(10, mean=2, sd=7000)) Supermarket - matrix(rnorm(15, mean=12000, sd=4000)) Minimarket - matrix(rnorm(20, mean=1, sd=4000)) Cornershop - matrix(rnorm(20, mean= 8000, sd=3000)) Spazashop - matrix(rnorm(35, mean= 7000,

Re: [R] The code behind the function

2009-09-09 Thread Erik Iverson
-- How can I see the code behind the function. For example, boxplot function (x, ...) UseMethod(boxplot) environment: namespace:graphics I really would like to see how people code this.

Re: [R] How to return/show the indexes of unusual points in boxplot?

2009-09-09 Thread Henrique Dallazuanna
Try this: bp - boxplot(c(4,rnorm(20),8)) bp$out On Wed, Sep 9, 2009 at 4:25 PM, g...@ucalgary.ca wrote: I am wondering if you know how to return by function or show in boxplot, the indexes of unusual points, such as, points that are outside the box or in [Q3+1.5IQR,Max]. For example,

Re: [R] The code behind the function

2009-09-09 Thread cls59
Chunhao Tu wrote: Hi R users, I have a question. How can I see the code behind the function. For example, boxplot function (x, ...) UseMethod(boxplot) environment: namespace:graphics I really would like to see how people code this. Could someone please show me how to see the

Re: [R] How to return/show the indexes of unusual points in boxplot?

2009-09-09 Thread jim holtman
boxplot returns a dataframe that has the values in it at $out: x - boxplot(c(4,rnorm(20),8)) x $stats [,1] [1,] -1.5364498 [2,] -0.5282799 [3,] -0.1398736 [4,] 0.3065579 [5,] 1.3430388 $n [1] 22 $conf [,1] [1,] -0.4210947 [2,] 0.1413474 $out [1] 4 8 $group [1] 1 1

Re: [R] lag a data.frame column?

2009-09-09 Thread Mark Knecht
On Wed, Sep 9, 2009 at 11:09 AM, Achim Zeileis achim.zeil...@wu-wien.ac.at wrote: On Wed, 9 Sep 2009, Mark Knecht wrote: Sometimes it's the simple things... Why doesn't this lag X$x by 3 and place it in X$x1? It does. (i.e. - Na's in the first 3 rows and then values showing up...)

Re: [R] How to return/show the indexes of unusual points in boxplot?

2009-09-09 Thread guox
Thank you very much. But it seems that x$out returns the values not the indexes of the values (1,22). -james boxplot returns a dataframe that has the values in it at $out: x - boxplot(c(4,rnorm(20),8)) x $stats [,1] [1,] -1.5364498 [2,] -0.5282799 [3,] -0.1398736 [4,]

Re: [R] How to return/show the indexes of unusual points in boxplot?

2009-09-09 Thread jim holtman
use 'match' to get the indices; match(x$out, yourData) On Wed, Sep 9, 2009 at 4:07 PM, g...@ucalgary.ca wrote: Thank you very much. But it seems that x$out returns the values not the indexes of the  values (1,22). -james boxplot returns a dataframe that has the values in it at $out: x -

Re: [R] How to return/show the indexes of unusual points in boxplot?

2009-09-09 Thread Jorge Ivan Velez
Hi James, If that's the case, then set.seed(123) x - c(4,rnorm(20),8) bp - boxplot(x) bp$out # [1] 4 8 which(x %in% bp$out) # [1] 1 22 is what you are looking for. :-) HTH, Jorge On Wed, Sep 9, 2009 at 4:07 PM, g...@ucalgary.ca wrote: Thank you very much. But it seems that x$out returns

[R] Stats help with calculating between and within subject variance and confidence intervals

2009-09-09 Thread Paul
Hello. I'm trying to find a way in R to calculate between and within subject variances and confidence intervals for some analytical method development data. I've found a reference to a method in Burdick, R. K. Graybill, F. A. 1992, Confidence Intervals on variance components, CRC Press.

Re: [R] How to return/show the indexes of unusual points in boxplot?

2009-09-09 Thread guox
Thanks for your help. -jmaes Hi James, If that's the case, then set.seed(123) x - c(4,rnorm(20),8) bp - boxplot(x) bp$out # [1] 4 8 which(x %in% bp$out) # [1] 1 22 is what you are looking for. :-) HTH, Jorge On Wed, Sep 9, 2009 at 4:07 PM, g...@ucalgary.ca wrote: Thank you

Re: [R] Combining simulated data

2009-09-09 Thread KABELI MEFANE
Thank you very much, now i can proceed to my next task. THANK YOU   --- On Wed, 9/9/09, Schalk Heunis schalk.heu...@enerweb.co.za wrote: From: Schalk Heunis schalk.heu...@enerweb.co.za Subject: Re: [R] Combining simulated data To: KABELI MEFANE kabelimef...@yahoo.co.uk Cc: R-help@r-project.org

Re: [R] Joining Characters in R {issue with paste}

2009-09-09 Thread milton ruser
You not tryed ?paste :-) paste(a,b,sep=) bests milton On Wed, Sep 9, 2009 at 5:08 PM, Abhishek Pratap abhishek@gmail.comwrote: Hi Guys I am want to join to strings in R. I am using paste but not getting desirable result. For the sake of clarity, a quick example: a=Bio b=iology

Re: [R] Joining Characters in R {issue with paste}

2009-09-09 Thread Erik Iverson
And did you read the help file, ?paste , paying attention to the arguments and their descriptions, specifically the sep argument? Presumably, you want, paste(a, b, sep = ) -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of

Re: [R] Joining Characters in R {issue with paste}

2009-09-09 Thread Abhishek Pratap
I did try ?paste and paste(a,b,separator=). same result Thanks, -Abhi On Wed, Sep 9, 2009 at 5:11 PM, milton ruser milton.ru...@gmail.com wrote: You not tryed ?paste :-) paste(a,b,sep=) bests milton On Wed, Sep 9, 2009 at 5:08 PM, Abhishek Pratap abhishek@gmail.comwrote: Hi Guys

Re: [R] Joining Characters in R {issue with paste}

2009-09-09 Thread Abhishek Pratap
guys I am sorry may be it is that part of the day where my eyes are not able to read. using separator instead of sep. Thanks a lot, -Abhi On Wed, Sep 9, 2009 at 5:12 PM, Erik Iverson eiver...@nmdp.org wrote: And did you read the help file, ?paste , paying attention to the arguments and their

Re: [R] Joining Characters in R {issue with paste}

2009-09-09 Thread Clint Bowman
?paste and look at sep. On Wed, 9 Sep 2009, Abhishek Pratap wrote: Hi Guys I am want to join to strings in R. I am using paste but not getting desirable result. For the sake of clarity, a quick example: a=Bio b=iology paste(a,b) [1] Bio iology *There is a SPACE in the word biology which

Re: [R] Joining Characters in R {issue with paste}

2009-09-09 Thread Rolf Turner
On 10/09/2009, at 9:08 AM, Abhishek Pratap wrote: Hi Guys I am want to join to strings in R. I am using paste but not getting desirable result. For the sake of clarity, a quick example: a=Bio b=iology paste(a,b) [1] Bio iology *There is a SPACE in the word biology which is what I dont

Re: [R] Stats help with calculating between and within subject variance and confidence intervals

2009-09-09 Thread Bert Gunter
Paul: If these data are real -- or at least a reasonable facsimile -- then even though the machines might be considered random -- i.e. a sample from a potential population of machines -- there are too few of them to get a reasonable estimate of their variance. Better to treat them as fixed and

Re: [R] Recursion is slow

2009-09-09 Thread Martin Morgan
Hi Bryan -- Bryan Keller wrote: Bill, Thanks for the great tips for speeding up functions in your response. Those are really useful for me. Even with the improvements the recursion is still many times slower than I need it to be in order to make it useful in R. I may just have to

[R] Xyplot, multi line title via main, all lines left justified

2009-09-09 Thread Afshartous, David
All, Below is an xyplot plot with multiple panels and a title produced via main: library(lattic) data.ex = data.frame(y = rnorm(10), t = rep(1:5, 2), group = rep(c(0,1), each = 5)) xyplot(y ~ t | as.factor(group), data = data.ex, main = list(Put figure caption here

Re: [R] DOE in R?

2009-09-09 Thread Carlos J. Gil Bellosta
Hello, I think I misread the link you sent me yesterday. In any case, the reason why SAS generates a model with 30 trials whereas R produces another one with 25 is that, if the parameter for the number of trials is not specified in the proc/function call, both systems adhere to different

Re: [R] Recursion is slow

2009-09-09 Thread William Dunlap
Note that the memoization optimization is orthogonal to the simpler optimizations I suggested (don't repeat calculations in loops, sort the input vector, do a little math to avoid so many recursions to the leaves). You can combine them to get Cmemo1 - function(T, m) { C - function(lt, m) {

Re: [R] Help on percentage of random numbers for different classes

2009-09-09 Thread KABELI MEFANE
R-list   I am sorry for asking this stupid question, but i have been running in circles. I want to randomly generate a scaling point of between 1 and 10, for say hundred entries, where the first 10% percent is has rates between 2 and 7, the next 15% 3 and 7, 20% between 3 and 9, 20% between 3

Re: [R] Very basic question regarding plot.Design...

2009-09-09 Thread Frank E Harrell Jr
I just added a new option nlines to plot.Predict to make it easy to get interaction line plots for categorical predictors. To get the new version type the following after running require(rms): source('http://biostat.mc.vanderbilt.edu/tmp/plot.Predict.s') Here are some examples: require(rms)

Re: [R] Help on percentage of random numbers for different classes

2009-09-09 Thread Nordlund, Dan (DSHS/RDA)
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of KABELI MEFANE Sent: Wednesday, September 09, 2009 4:06 PM To: R-help@r-project.org Subject: Re: [R] Help on percentage of random numbers for different classes R-list I am

[R] Read.csv in R with dynamic file (1st) argument

2009-09-09 Thread Steven Kang
Dear R users, I have numerous data sets (csv files) saved in the folder which has the same name as individual data. (i.e data x1 saved in x1 folder, data x2 in x2 folder etc) I would like to read in the desired data set name using 'scan' function and assign this inputted value to an object so

Re: [R] Read.csv in R with dynamic file (1st) argument

2009-09-09 Thread Henrique Dallazuanna
Try this: read.csv(sprintf(D://R//Data//%04d//%04d.csv, x, x), header = TRUE) On Wed, Sep 9, 2009 at 9:32 PM, Steven Kang stochastick...@gmail.comwrote: Dear R users, I have numerous data sets (csv files) saved in the folder which has the same name as individual data. (i.e data x1 saved

[R] inline function in apply

2009-09-09 Thread bwgoudey
I've been trying to filling in the missing variables in a matrix with the mean from the column they are in. So the following code does this just fine. #3X3 matrix where the middle number is missing. data=matrix(c(1:4,NA,6:9), 3, 3) #replace missing values in an vector with the mean of the

Re: [R] inline function in apply

2009-09-09 Thread Gabor Grothendieck
Try this: fill.in.1 - function(x) ifelse(is.na(x), mean(x, na.rm = TRUE), x) apply(data, 2, fill.in.1) or fill.in.2 - function(x) replace(x, is.na(x), mean(x, na.rm = TRUE)) apply(data, 2, fill.in.2) Note that in both cases a column containing only NAs will be filled with NaN's. On Wed, Sep