[R] Vector recycling and zoo

2010-05-16 Thread Sean Carmody
I am a bit confused about the different approaches taken to recycling in plain data frames and zoo objects. When carrying out simple arithmetic, dataframe seem to recycle single arguments, zoo objects do not. Here is an example x - data.frame(a=1:5*2, b=1:5*3) x a b 1 2 3 2 4 6 3 6 9

[R] Location attribute

2010-05-16 Thread M. (AMFOR)
hi everybody, a question, as I can know the location (number) of an attribute with its name. Ej. X1 X2 X3 X4 X5 X6 1 3 5 2 1 7 6 7 4 5 2 9 as I can know that the attribute X4 is in position 4 I hope you can help me from already thank you very much to all Agustín

[R] p value

2010-05-16 Thread Soham
How to compute the p-value of a statistic generally? -- View this message in context: http://r.789695.n4.nabble.com/p-value-tp2217867p2217867.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] Location attribute

2010-05-16 Thread M. (AMFOR)
hi everybody, a question, as I can know the location (number) of an attribute with its name. Ej. X1 X2 X3 X4 X5 X6 1 3 5 2 1 7 6 7 4 5 2 9 as I can know that the attribute X4 is in position 4 I hope you can help me from already thank you very much to all Agustín

[R] How to manage an error message about NA/NaN/Inf

2010-05-16 Thread Moohwan Kim
Dear R Family, I have an error message. I would like to learn how to deal with that. The orginal series is as follows: I just pick up the first 10 observations. dif_transaud[1:10] [1] 0.0065880493 -0.0065880490 -0.0131743570 0.0197745715 0.0065889175 [6] 0.0131813110 0.0065923924

[R] number of location attribute with its name

2010-05-16 Thread M. (AMFOR)
hi everybody, a question, as I can know the location (number) of an attribute with its name. Ej. X1 X2 X3 X4 X5 X6 1 3 5 2 1 7 6 7 4 5 2 9 as I can know that the attribute X4 is in position 4 I hope you can help me from already thank you very much to all Agustín

Re: [R] How to rank matrix data by deciles?

2010-05-16 Thread Peter Ehlers
On 2010-05-13 17:50, Phil Spector wrote: Vincent - I'm afraid there's no solution other than artificially modifying the zeroes: vec [1] 26.58950617 5.73074074 5.9622 5.6478 20.95728395 0. 0.0700 12.8689 [9] 3.64543210 0.05049383 25.6089 3.53246914 0.

[R] sample

2010-05-16 Thread Laetitia Schmid
Hi, I am sampling two random columns from females and two random columns from males to produce tetraploid offspring. For every female I am sampling a random male. In the end I want to write out a a matrix with all the offspring, but that does not work. I get always only the offspring from

Re: [R] improvement

2010-05-16 Thread Sebastian Kruk
Hi, if i just want a vector filled with names which has length(index) 0. For example if nombreC - c(Juan, Carlos, Ana, María) nombreL - c(Juan Campo, Carlos Gallardo, Ana Iglesias, María Bacaldi, Juan Grondona, Dario Grandineti, Jaime Acosta, Lourdes Serrano) I would like to obtain a matrix

Re: [R] Location attribute

2010-05-16 Thread Ted Harding
On 16-May-10 06:11:52, Agustín Muñoz M. (AMFOR) wrote: hi everybody, a question, as I can know the location (number) of an attribute with its name. Ej. X1 X2 X3 X4 X5 X6 1 3 5 2 1 7 6 7 4 5 2 9 as I can know that the attribute X4 is in position 4 I hope you

Re: [R] p value

2010-05-16 Thread Tal Galili
Hi Soham, I don't feel your question is well defined. But an equally ill defined answer would be: Through a permutation test. Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com

Re: [R] problem with making multiple plots (geom_pointrange) in a loop (ggplot2)

2010-05-16 Thread baptiste auguie
Hi, On 16 May 2010 03:31, michael westphal mi_westp...@yahoo.com wrote: [ snipped ] Any suggestions? i'd suggest you - read the posting guide - upgrade your R to the latest version - don't post to two mailing lists - make your example minimal, self-contained, reproducible - show the result of

[R] RODBC-Error-sqlSave

2010-05-16 Thread Johan Lassen
Dear R-community, After repeating the sqlSave-command 3 times on a dataframe (of size 13149 rows * 5 columns) to my MS-Access database I get the following error: *Error in sqlSave(channel, eksport_transp_acc_2, transp_acc_scenarier, : unable to append to table ‘transp_acc_scenarier’* ** This

Re: [R] sample

2010-05-16 Thread Peter Ehlers
On 2010-05-16 2:23, Laetitia Schmid wrote: Hi, I am sampling two random columns from females and two random columns from males to produce tetraploid offspring. For every female I am sampling a random male. In the end I want to write out a a matrix with all the offspring, but that does not work.

Re: [R] abline limit constrain x-range how?

2010-05-16 Thread Jim Lemon
On 05/16/2010 12:03 AM, Giovanni Azua wrote: Hello, I managed to linearize my LDA decision boundaries now I would like to call abline three times but be able to specify the exact x range. I was reading the doc but it doesn't seem to support this use-case? are there alternatives. The reason

Re: [R] Normalizing plot tick values

2010-05-16 Thread Jim Lemon
On 05/16/2010 03:10 AM, rajesh j wrote: Hi, I have a plot whole tick values along the axis have a certain range 0 - x . I need to normalize this range without changing my data files. for e.g., if my plot has tick values at 10,20,30,40,50... i have to make this 2,4,6, etc. but without changing

Re: [R] Vector recycling and zoo

2010-05-16 Thread David Winsemius
On May 16, 2010, at 2:00 AM, Sean Carmody wrote: I am a bit confused about the different approaches taken to recycling in plain data frames and zoo objects. When carrying out simple arithmetic, dataframe seem to recycle single arguments, zoo objects do not. Here is an example x -

[R] Loading Intraday Time Series Data

2010-05-16 Thread Steve Johns
Hi, I am trying to load a data file that looks like this: |Date,Time,Open,High,Low,Close,Up,Down 05/02/2001,0030,421.20,421.20,421.20,421.20,11,0 05/02/2001,0130,421.20,421.40,421.20,421.40,7,0 05/02/2001,0200,421.30,421.30,421.30,421.30,0,5 05/02/2001,0230,421.60,421.60,421.50,421.50,26,1|

Re: [R] number of location attribute with its name

2010-05-16 Thread David Winsemius
On May 16, 2010, at 2:24 AM, Agustín Muñoz M. (AMFOR) wrote: hi everybody, a question, as I can know the location (number) of an attribute with its name. Ej. X1 X2 X3 X4 X5 X6 1 3 5 2 1 7 6 7 4 5 2 9 as I can know that the attribute X4 is in position 4 It is

Re: [R] RODBC-Error-sqlSave

2010-05-16 Thread Orvalho Augusto
Let us see if it is a R issue. Try this: Read the CSV on Ms Access directly. It is an importation on MsAccess. If you succeed we will check R then. Caveman On Sun, May 16, 2010 at 11:48 AM, Johan Lassen johanlas...@gmail.com wrote: Dear R-community, After repeating the sqlSave-command 3

Re: [R] Loading Intraday Time Series Data

2010-05-16 Thread Gabor Grothendieck
In zoo the index= argument to read.zoo can be a vector of column indices to indicate that the time is split across multiple columns and the FUN= argument can be used to process the multiple columns. In this example the resulting z uses chron: L - Date,Time,Open,High,Low,Close,Up,Down

Re: [R] Loading Intraday Time Series Data

2010-05-16 Thread John Kane
Hi Steve, I think what you want to do is get a unique time-date from the first two columns. Try something like this: (changing the file name obviously. mydate should give you a time and date format that you can add to the existing data.frame. mydata - read.table(C:/rdata/dates.junk.csv,

Re: [R] Questions about ggplot2

2010-05-16 Thread Juliet Hannah
I started with the summarized data, and there are different ways to do this. For this example, let there be four columns and a corresponding sum of 1s. library(ggplot2) mydf - data.frame(colname = c(A,B,C,D),mycolsum=c(1:4)) p - ggplot(mydf,aes(x=colname,y=mycolsum)) p - p + geom_bar(stat =

Re: [R] Vector recycling and zoo

2010-05-16 Thread Gabor Grothendieck
When you combine zoo objects with arithmetic it merges them using all = FALSE: library(zoo) x - data.frame(a=1:5*2, b=1:5*3) x - zoo(x); x a b 1 2 3 2 4 6 3 6 9 4 8 12 5 10 15 # these two are the same x$a/x$a[1] 1 1 m - merge(x$a, x$a[1], all = FALSE) m x$a x$a[1] 1 2

[R] Box-Cox Transformation: Drastic differences when varying added constants

2010-05-16 Thread Holger Steinmetz
Dear experts, I tried to learn about Box-Cox-transformation but found the following thing: When I had to add a constant to make all values of the original variable positive, I found that the lambda estimates (box.cox.powers-function) differed dramatically depending on the specific constant

[R] Reading JPEG file, converting to HEX

2010-05-16 Thread Dennis Fisher
Colleagues, I am using R to assemble RTF documents (which are plain text). I need to embed a JPEG graphic that was created with R. I presume that the steps need to be: a. read the file into R b. convert the object to HEX format c. write the converted object to a

Re: [R] p value

2010-05-16 Thread Bert Gunter
runif(1) Bert Gunter Genentech Nonclinical Statistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Soham Sent: Saturday, May 15, 2010 9:05 AM To: r-help@r-project.org Subject: [R] p value How to compute the p-value of a

[R] function density (stats): parameter n

2010-05-16 Thread Paulo Barata
Dear R-list members, About the parameter n of the function density() (Kernel Density Estimation, package stats): The R HTML documentation says about the parameter n: the number of equally spaced points at which the density is to be estimated. When n 512, it is rounded up to the next power of

Re: [R] plot for linear discriminant

2010-05-16 Thread Hadley Wickham
Hi Giovanni, Have a look at the classifly package for an alternative approach that works for all classification algorithms. If you provided a small reproducible example, I could step through it for you. Hadley On Sat, May 15, 2010 at 6:19 AM, Giovanni Azua brave...@gmail.com wrote: Hello, I

Re: [R] Reading JPEG file, converting to HEX

2010-05-16 Thread jim holtman
Use readBin: readBin('/path/to/file', 'raw', n=100) Here is an example of reading in a JPEG file: x - readBin(fileName,'raw',n=100) str(x) raw [1:801403] ff d8 ff e1 ... # convert to a HEX string (on the first 20 bytes) paste(sprintf(%s, x[1:20]), collapse='') [1]

Re: [R] how to profile R interpreter?

2010-05-16 Thread Erich Neuwirth
Look for Rprof in the utils package. On 5/12/2010 9:22 PM, xiaoming gu wrote: Hi, all. Does anyone know how to profile R interpreter? I've tried gprof but it doesn't work. Thanks. Xiaoming -- Erich Neuwirth, University of Vienna Faculty of Computer Science Center for Computer Science

Re: [R] Discretize factors?

2010-05-16 Thread Noah Silverman
Thanks, That gives me exactly what I'm looking for. Two quick questions: 1) What would be the fastest way to do this if I have other continuous data as well. For example, I have a data frame with 10 variable and want to discretize one of them using this method. (Say, column 6 for example.) I

Re: [R] Box-Cox Transformation: Drastic differences when varying added constants

2010-05-16 Thread Peter Ehlers
On 2010-05-16 6:22, Holger Steinmetz wrote: Dear experts, I tried to learn about Box-Cox-transformation but found the following thing: When I had to add a constant to make all values of the original variable positive, I found that the lambda estimates (box.cox.powers-function) differed

Re: [R] Discretize factors?

2010-05-16 Thread Noah Silverman
Update, I have it working, but now its producing really ugly labels. Must be a small adjustment to the code. Any ideas?? ##Create example data.frame group - c(A, B,B,C,C,C) a - c(1,4,3,4,5,6) b - c(5,4,5,3,4,5) d - data.frame(cbind(a,b,group)) #create new frame with discretized group

Re: [R] Splines under tension

2010-05-16 Thread sam.e
Thank you for the helpful direction to the smoothing splines function, it was very helpful and is exactly what i am trying to do. My data however is 3-D, i.e. i have x and y values which are coordinates for different field sites and z values which are really what I am interested in analysing with

Re: [R] plot for linear discriminant

2010-05-16 Thread Giovanni Azua
Hello Hadley, Thank you very much for your help! I have just received your book btw :) On May 16, 2010, at 6:16 PM, Hadley Wickham wrote: Hi Giovanni, Have a look at the classifly package for an alternative approach that works for all classification algorithms. If you provided a small

Re: [R] Attempt to customise the plotpc() function

2010-05-16 Thread Nikos Alexandris
Nikos Alexandris: Among the (R-)tools, I've seen on the net, for (bivariate) Principal Component scatter plots (+histograms), plotpc [1] is the one I like most. [...] I started the modification by attempting first to get a prcomp version of plotpc() (named it plotpc.svd()) by altering the

Re: [R] Attempt to customise the plotpc() function

2010-05-16 Thread Peter Ehlers
Nikos, I think you can just replace the line pc - princomp(x[,1:2], scores=TRUE, na.action=na.fail) with pc - prcomp(x[,1:2], retx=TRUE, center=pc.center, scale.=pc.scale, na.action=na.fail) and rename the components of pc names(pc) - c('sdev', 'loadings',

Re: [R] Discretize factors?

2010-05-16 Thread Peter Ehlers
On 2010-05-16 11:06, Noah Silverman wrote: Update, I have it working, but now its producing really ugly labels. Must be a small adjustment to the code. Any ideas?? ##Create example data.frame group- c(A, B,B,C,C,C) a- c(1,4,3,4,5,6) b- c(5,4,5,3,4,5) d- data.frame(cbind(a,b,group)) #create

Re: [R] Discretize factors?

2010-05-16 Thread Noah Silverman
I could, but with close to 100 columns, its messy. On 5/16/10 11:22 AM, Peter Ehlers wrote: On 2010-05-16 11:06, Noah Silverman wrote: Update, I have it working, but now its producing really ugly labels. Must be a small adjustment to the code. Any ideas?? ##Create example data.frame

Re: [R] Attempt to customise the plotpc() function

2010-05-16 Thread Nikos Alexandris
Peter Ehlers wrote: Nikos, I think you can just replace the line pc - princomp(x[,1:2], scores=TRUE, na.action=na.fail) with pc - prcomp(x[,1:2], retx=TRUE, center=pc.center, scale.=pc.scale, na.action=na.fail) and rename the components of pc

Re: [R] Attempt to customise the plotpc() function

2010-05-16 Thread Nikos Alexandris
Peter Ehlers wrote: and then use the rest of the plotpc() code as is (except for maybe having to use flip1=TRUE, etc). Nikos: Hmm... I am _now_ working on it to understand how I could make this automatic!. If I give flip1, flip2 (=TRUE) the histograms are located where they should

Re: [R] RODBC-Error-sqlSave

2010-05-16 Thread Johan Lassen
Thank you so much for pointing on this obvious check of the MS Access database! Inspired, I tried to import the csv-file directly into the MS Access database and I encountered an Error saying (freely translated from Danish) : Cannot find search key. The MS Access database is in MS Access-2000

Re: [R] how to profile R interpreter?

2010-05-16 Thread Sharpie
Erich Neuwirth wrote: Look for Rprof in the utils package. This was already suggested- but the original poster clarified that he is looking to profile the R interpreter it's self, not R scripts. - Charlie Sharpsteen Undergraduate-- Environmental Resources Engineering Humboldt State

[R] GSA getting ngenes into the list

2010-05-16 Thread Loren Engrav
Greetings I suppose a simple matter for R experts but for me... Am using GSA and have the GSA.obj (class GSA) created with GSA that contains the value ngenes visible with GSA.obj$ngenes And I have the list object (class list) created with GSA.listsets that contains Table of negative sets with

Re: [R] Discretize factors?

2010-05-16 Thread Thomas Stewart
Maybe this will lead you to an acceptable solution. Note that changed how the data set is created. (In your example, the numeric variables were being converted to factor variables. It seems to me that you want something different.) The key difference between my code and yours is that I use the

Re: [R] Discretize factors?

2010-05-16 Thread Peter Ehlers
And if you do have many variables in one dataframe, you might wish to construct the formula first using paste(): nm - c(0, names(d)[-c(1,2)]) fo - as.formula(paste(~, paste(nm, collapse= +))) d - cbind(d, model.matrix(fo, data=d) -Peter Ehlers On 2010-05-16 15:30, Thomas Stewart wrote:

[R] predict.lda breaks when priors are specified

2010-05-16 Thread Andrew Redd
Dear R help, What am I doing wrong here? when I don't specify the priors it works just fine but when I specify the priors it breaks.  Does anyone know why and how I can fix it? N=2 ncontrol=ncases=50 X - as.matrix(rnorm(N,0,1)) eta - -5.3 + X * 1.7 p - exp(eta)/(1+exp(eta)) Y -

Re: [R] predict.lda breaks when priors are specified

2010-05-16 Thread Andrew Redd
Never mind. Stupid misplaced 's'. -Andrew On Sun, May 16, 2010 at 5:39 PM, Andrew Redd ar...@stat.tamu.edu wrote: Dear R help, What am I doing wrong here? when I don't specify the priors it works just fine but when I specify the priors it breaks.  Does anyone know why and how I can fix it?

Re: [R] Vector recycling and zoo

2010-05-16 Thread Sean Carmody
Thanks David, You comment made me realise that whereas when x is a data frame, x$a is a numeric vector, when x is of class zoo, x$a is also of class zoo, so the following does what I was expecting: x$a/as.numeric(x$a[1]) Sean. On Sun, May 16, 2010 at 9:25 PM, David Winsemius

Re: [R] Vector recycling and zoo

2010-05-16 Thread Gabor Grothendieck
Normally that would be written like this using the coredata extraction function which extracts the data portion of a zoo object: x$a / coredata( x$a[1] ) On Sun, May 16, 2010 at 7:32 PM, Sean Carmody seancarm...@gmail.com wrote: Thanks David, You comment made me realise that whereas when x is

Re: [R] Vector recycling and zoo

2010-05-16 Thread Gabor Grothendieck
Or even: with(x, a / coredata(a[1]) ) On Sun, May 16, 2010 at 7:48 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: Normally that would be written like this using the coredata extraction function which extracts the data portion of a zoo object: x$a / coredata( x$a[1] ) On Sun, May

[R] sapply code

2010-05-16 Thread Roslina Zakaria
Hi r-users,   I have this code here, but I just wonder how do I use 'sapply' to make it more efficient lamda_cor - eigen(winter_cor)$values   lamda_cor [1] 1.3459066 1.0368399 0.8958128 0.7214407   lamda_cxn - function(dt) { n   - length(dt)   term    - vector(length=n, mode=numeric)    

Re: [R] sapply code

2010-05-16 Thread Henrique Dallazuanna
Try this: 1 + (1 / log(length(lambda_cor))) * sum((l - lambda_cor / length(lambda_cor)) * log(l)) On Sun, May 16, 2010 at 10:43 PM, Roslina Zakaria zrosl...@yahoo.comwrote: Hi r-users, I have this code here, but I just wonder how do I use 'sapply' to make it more efficient lamda_cor -

Re: [R] Splines under tension

2010-05-16 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of sam.e Sent: Sunday, May 16, 2010 10:13 AM To: r-help@r-project.org Subject: Re: [R] Splines under tension Thank you for the helpful direction to the smoothing splines

Re: [R] Normalizing plot tick values

2010-05-16 Thread rajesh j
Hi, I tried using this in my plot and I get an error saying 'at' and 'labels' lengths differ, 8 != 5 ~Rajesh On Sat, May 15, 2010 at 10:47 PM, Henrique Dallazuanna www...@gmail.comwrote: Try this: x - 1:100 plot(x, xaxt = 'n') axis(1, axTicks(1), pretty(x) / 10) On Sat, May 15, 2010 at