Re: [R] by funtion

2010-04-29 Thread Tengfei Yin
Hi you could try do.call('rbind',aa) then turn the matrix into data frame regards Tengfei On Wed, Apr 28, 2010 at 10:56 PM, Yuan Jian jayuan2...@yahoo.com wrote: Hello, I have a data.frame: namecol1col2col3col4 AA23540.9990.78 BB12351

[R] Odp: by funtion

2010-04-29 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 29.04.2010 05:56:23: Hello, I have a data.frame: namecol1col2col3col4 AA23540.9990.78 BB123510.99 AA203980.790.99 I want to get mean value data.frame in terms of name: name

Re: [R] non linear estimation

2010-04-29 Thread Petr PIKAL
Hi I put a search question about nonlinear programming in R site search and got many answers maybe you could find something which suits your needs. Maybe you could also look at CRAN task view - Optimisation and Mathematical programming Regards Petr r-help-boun...@r-project.org napsal dne

Re: [R] by funtion

2010-04-29 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 29.04.2010 08:11:41: Hi you could try do.call('rbind',aa) No, No, No. rbind and cbind binds vectors as rows or columns of ***matrix***, result is not a data frame do.call(rbind,aa) X069rutil X102anatas 105 26.97.9 200

Re: [R] by funtion

2010-04-29 Thread Tengfei Yin
Hi, Thanks, actually I mentioned in the reply, you need to turn the matrix into data frame in the end if use this method. e.g df=data.frame(name=c('AA','BB','AA'),c1=c(23,123,203),c2=c(54,5,98),c3=c(0.999,1,0.79),c4=c(0.78,0.99,0.99)) aa=by(df[,2:5],df$name,mean) dd=do.call('rbind',aa)

Re: [R] non linear estimation

2010-04-29 Thread Rubén Roa
-Mensaje original- De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] En nombre de JamesHuang Enviado el: jueves, 29 de abril de 2010 3:38 Para: r-help@r-project.org Asunto: Re: [R] non linear estimation any suggestion? actually I just wanna know if there

Re: [R] by funtion

2010-04-29 Thread Yuan Jian
Thanks Tengfei, I have another question. df=data.frame(name=c('AA','BB', 'CC'),c1=c(23,123,5),c2=c(54,5,4),c3=c(0.999,1,23),c4=c(0.78,0.99,54)) df   name  c1 c2 c3    c4 1   AA  23 54  0.999  0.78 2   BB 123  5  1.000  0.99 3   CC   5  4 23.000 54.00 df1=data.frame(name=c('BB','AA',

Re: [R] Exporting an rgl graph

2010-04-29 Thread cgenolin
I need to use the function saveTriangleAsASY in my package. Does it allready exist in a package or may I unclude it ? Christophe -- View this message in context: http://r.789695.n4.nabble.com/Exporting-an-rgl-graph-tp1872712p2075086.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] by funtion

2010-04-29 Thread Petr PIKAL
Hi sorry I did not read your reply as thoroughly. But generally matrices are quite often exchanged for data frames. Also if you have list with mixture of numeric and nonumeric data such approach results in nonumeric output as matrix can have values only of one type. I would therefore generally

Re: [R] by funtion

2010-04-29 Thread Petr PIKAL
Hi probably merge is what you want see ?merge Regards Petr r-help-boun...@r-project.org napsal dne 29.04.2010 09:13:34: Thanks Tengfei, I have another question. df=data.frame(name=c('AA','BB', 'CC'),c1=c(23,123,5),c2=c(54,5,4),c3=c(0. 999,1,23),c4=c(0.78,0.99,54)) df name c1 c2

[R] Split a vector by NA's - is there a better solution then a loop ?

2010-04-29 Thread Tal Galili
Hi all, I would like to have a function like this: split.vec.by.NA - function(x) That takes a vector like this: x - c(2,1,2,NA,1,1,2,NA,4,5,2,3) And returns a list of length of 3, each element of the list is the relevant segmented vector, like this: $`1` [1] 2 1 2 $`2` [1] 1 1 2 $`3` [1] 4 5 2

[R] using get and paste in a loop to return objects for object names listed a strings

2010-04-29 Thread Nevil Amos
I am trying to create a heap of boxplots, by looping though a series of factors and variables in a large data.frame suing paste to constrcut the facto and response names from the colnames I thought I could do this using get() however it is not working what am I doing wrong? thanks Nevil Amos

Re: [R] Split a vector by NA's - is there a better solution then a loop ?

2010-04-29 Thread Romain Francois
Maybe this : foo - function( x ){ + idx - 1 + cumsum( is.na( x ) ) + not.na - ! is.na( x ) + split( x[not.na], idx[not.na] ) + } foo( x ) $`1` [1] 2 1 2 $`2` [1] 1 1 2 $`3` [1] 4 5 2 3 Romain Le 29/04/10 09:42, Tal Galili a écrit : Hi all, I would like to have a function like

Re: [R] function which saves an image of a dgtMatrix as png

2010-04-29 Thread Gildas Mazo
Thanks so much Douglas Bates a écrit : image applied to a sparseMatrix object uses lattice functions to create the image. As described in R FAQ 7.22 you must use print(image(x)) or show(image(x)) or even plot(image(x)) when a lattice function is called from within another

Re: [R] by funtion

2010-04-29 Thread Tengfei Yin
Hi Petr, Thanks for your suggestions:) @Yuan, Petr is right, you can try merge(df,df1,'name') Regards Tengfei On Thu, Apr 29, 2010 at 2:20 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Hi probably merge is what you want see ?merge Regards Petr r-help-boun...@r-project.org napsal

[R] Compact Patricia Trees (Tries)

2010-04-29 Thread Richard R. Liu
I have an application that a long list of character strings to determine which occur at the beginning of a given word.  A straight forward R script using grep takes a long time to run.  Rewriting it to use substr and match might be an option, but I have the impression that preparing the list as a

Re: [R] Split a vector by NA's - is there a better solution then a loop ?

2010-04-29 Thread Tal Galili
Definitely Smarter, Thanks! Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English)

Re: [R] Problem with optimization (constrOptim)

2010-04-29 Thread Człowiek Kuba
Hi, You are right, my intention was to return a set of values and to minimize them all in a multicriteria optimization problem. The interesting thing is that when I actually used scalar return of this function, by minimizing sum of squares in this form: fr - function(z) {

Re: [R] Lattice Groups

2010-04-29 Thread Santosh
Dear R experts.. Related to the example below, (which was discussed earlier)... How do I control the graphical elements of box, whiskers etc? I would like their colors go with specific groups. i tried changing par.settings(box.umbrella, box.rectangle etc)..and could not make them work.. Sample

[R] Request - adding recycled lwd parameter to polygon

2010-04-29 Thread Tal Galili
Hello dear members of R-help and R-core mailing list, I am not sure if this request is a ticket that should be filled somewhere outside the mailing list. If so, I apologize for not doing and would like to know where I should have filled it. And to the subject matter: I would like to use a

Re: [R] NLS amp;quot;Singular Gradientamp;quot; Error

2010-04-29 Thread bsnrh
Hi Ben, That's great, thank you very much indeed. Kind regards, Neal Quoting Ben Bolker [via R] ml-node+2074786-1865094303-243...@n4.nabble.com: bsnrh bsnrh at leeds.ac.uk writes: Hi Ben, Your book refers to the mle function in the emdbookx package. I was wondering if it's

Re: [R] using get and paste in a loop to return objects for object names listed a strings

2010-04-29 Thread Paul Hiemstra
Nevil Amos wrote: I am trying to create a heap of boxplots, by looping though a series of factors and variables in a large data.frame suing paste to constrcut the facto and response names from the colnames I thought I could do this using get() however it is not working what am I doing wrong?

[R] Random numbers with PDF of user-defined function

2010-04-29 Thread Nick Crosbie
Hi, In S+/R, is there an easy way to generate random numbers with a probability distribution specified by an exact user-defined function? For example, I have a function: f(x) = 1/(365 * x), which should be fitted for values of x between 1 and 100,000 How do I generate random numbers with a

Re: [R] Determining whether plot.new has been called

2010-04-29 Thread Jim Lemon
On 04/29/2010 02:21 AM, Dennis Fisher wrote: Colleagues I have a lengthy script that calls mtext. Under most circumstances, a graphics device is open and a plot exists, in which case mtext works as expected. However, there are some instances where the graphics device is open but no plot

[R] control span in panel.loess in xyplot

2010-04-29 Thread Santosh
Dear R gurus.. Is it possible to control span settings for different values of a grouping variable, when using xyplot? an example code shown below d=data.frame(x=rep(sample(1:5,rep=F),10),y=rnorm(50),z=rep(sample(LETTERS[1:2],rep=F),25))

Re: [R] control span in panel.loess in xyplot

2010-04-29 Thread Gabor Grothendieck
See ?panel.number for lattice functions that can be used in your panel function to discover which one is currently being drawn. On Thu, Apr 29, 2010 at 6:28 AM, Santosh santosh2...@gmail.com wrote: Dear R gurus.. Is it possible to control span settings for different values of a grouping

Re: [R] Help in web browser

2010-04-29 Thread Duncan Murdoch
On 28/04/2010 11:07 PM, Chintanu wrote: Hi, I have recently updated to R 2.10.1 in my windows system. Since then, whenever I look for help (e.g., by using ? Function command), the information is displayed by opening a web-browser. However, I rather would prefer to have the information in the

Re: [R] Compact Patricia Trees (Tries)

2010-04-29 Thread Gabor Grothendieck
Using charmatch partial matches of 10,000 5 leters words to the same list can be done in 10 seconds on my machine and 10,000 5 letter words to 100,000 10 letter words in 1 minute. Is that good enough? Try this simulation: # generate N random words each k long rwords - function(N, k) { L -

[R] UpdateLinks = FALSE

2010-04-29 Thread Albert-Jan Roskam
Hi,   I'm reading 100s of excel files and many of them contain links to external files (I hate that, but that aside). Every time such a file is opened, a menu pops up asking if I want to update the links. I never want to update the links. I used the macro recorder to see what code would be

[R] convert Factor as numeric

2010-04-29 Thread arnaud Gaboury
Dear group, I know this issue has been already covered, and before you reply I must say I have read the R-FAQ and search the mailing list archive. I still can't manage to change my factor to numeric as I couldn't find any clear answer. Here is my df : Pose1 - structure(list(DESCRIPTION =

Re: [R] Sweave question

2010-04-29 Thread Duncan Murdoch
On 28/04/2010 11:31 PM, Felipe Carrillo wrote: Hi: I am using Sweave and texi2dvi to generate a LaTeX document but can't find the way to hide the graphics while the R chunks are being executed. I thought results=hide would do it but that't not the case. Sweave runs figure chunks multiple

Re: [R] Random numbers with PDF of user-defined function

2010-04-29 Thread Robert A LaBudde
At 05:40 AM 4/29/2010, Nick Crosbie wrote: Hi, In S+/R, is there an easy way to generate random numbers with a probability distribution specified by an exact user-defined function? For example, I have a function: f(x) = 1/(365 * x), which should be fitted for values of x between 1 and 100,000

Re: [R] Random numbers with PDF of user-defined function

2010-04-29 Thread Duncan Murdoch
On 29/04/2010 5:40 AM, Nick Crosbie wrote: Hi, In S+/R, is there an easy way to generate random numbers with a probability distribution specified by an exact user-defined function? For example, I have a function: f(x) = 1/(365 * x), which should be fitted for values of x between 1 and 100,000

[R] errors returned upon trying to update JGR

2010-04-29 Thread mauede
I have upgraded R and am currently running the following version: R version 2.10.1 Patched (2010-02-20 r51163) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 The characteristics of my system are the following: OS: Linux 2.6.27.29-0.1-default x86_64 Current

Re: [R] convert Factor as numeric

2010-04-29 Thread Ben Bolker
arnaud Gaboury arnaud.gaboury at gmail.com writes: Dear group, I know this issue has been already covered, and before you reply I must say I have read the R-FAQ and search the mailing list archive. I still can't manage to change my factor to numeric as I couldn't find any clear answer.

Re: [R] Problem with optimization (constrOptim)

2010-04-29 Thread Nikhil Kaza
Ah..constrOptim is for linear inequality constraints. your ci is a matrix. it should be a vector. Nikhil On Apr 29, 2010, at 3:14 AM, Cz³owiek Kuba wrote: Hi, You are right, my intention was to return a set of values and to minimize them all in a multicriteria optimization problem.

Re: [R] non linear estimation

2010-04-29 Thread JamesHuang
hey, thanks and I actually ready found such packages such as nlme, but i failed to found the comment for restrictions, so.anyway, thanks fro your help. James -- View this message in context: http://r.789695.n4.nabble.com/non-linear-estimation-tp2072136p2075338.html Sent from the R help

Re: [R] non linear estimation

2010-04-29 Thread JamesHuang
it is an assignment, haha~~ I just simplify the question and i could do that in Excel using solver. I just wonder whether I can find a way to do that in R. The main problem is adding restrictions, I managed to do one question without restrictions in R by nls. James -- View this message in

Re: [R] convert Factor as numeric

2010-04-29 Thread arnaud Gaboury
TY petr, I was just trying something like that few mn ago :-) as.numeric(gsub(,, , S)) does exactly what I want. -Original Message- From: Petr PIKAL [mailto:petr.pi...@precheza.cz] Sent: Thursday, April 29, 2010 1:28 PM To: arnaud Gaboury Cc: r-help@r-project.org Subject: Odp:

Re: [R] Split a vector by NA's - is there a better solution then a loop ?

2010-04-29 Thread Henrique Dallazuanna
Another option could be: split(x, replace(cumsum(is.na(x)), is.na(x), -1))[-1] On Thu, Apr 29, 2010 at 4:42 AM, Tal Galili tal.gal...@gmail.com wrote: Hi all, I would like to have a function like this: split.vec.by.NA - function(x) That takes a vector like this: x -

Re: [R] UpdateLinks = FALSE

2010-04-29 Thread Albert-Jan Roskam
Sorry, I intended to send this straight to the rcom mailing list. It's about the rcom package. Cheers!! Albert-Jan ~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a

[R] randomness in stepclass (klaR) or lda (MASS) ?

2010-04-29 Thread Eric Elguero
Hi, a colleague ran a stepwise discriminant analysis twice in a row and got different results, suggesting some sochasticity in the algorithms involved. I looked at her data and found that there was a lot of collinearity, so that I reckoned that maybe stepclass (klaR) cannot find a clear winner

Re: [R] operator problem within function

2010-04-29 Thread Bunny, lautloscrew.com
Sorry for that offlist post, did not mean to do it intentionally. just hit the wrong button. Unfortunately this disadvantage is not written next to $ in the manual. On Apr 29, 2010, at 2:34 AM, Bunny, lautloscrew.com wrote: David, With your help i finally got it. THX! sorry for

[R] Using plyr::dply more (memory) efficiently?

2010-04-29 Thread Steve Lianoglou
Hi all, In short: I'm running ddply on an admittedly (somehow) large data.frame (not that large). It runs fine until it finishes and gets to the collating part where all subsets of my data.frame have been summarized and they are being reassembled into the final summary data.frame (sorry, don't

Re: [R] randomness in stepclass (klaR) or lda (MASS) ?

2010-04-29 Thread Uwe Ligges
On 29.04.2010 15:01, Eric Elguero wrote: Hi, a colleague ran a stepwise discriminant analysis twice in a row and got different results, suggesting some sochasticity in the algorithms involved. I looked at her data and found that there was a lot of collinearity, so that I reckoned that maybe

[R] Dendrogram and fusion levels

2010-04-29 Thread Timothée Poisot
Dear users, I am trying to extract the fusion levels from a dendrogram (in my case, phylogenetic trees in the 'phylo' format of APE). So far, I have not been successful. I can't believe there is not a library to do it, but I can't find a function that would extract the fusion levels. Do you

[R] lm() with non-linear coefficients constraints? --- nls?

2010-04-29 Thread ivo welch
dear R experts---quick question. I need to estimate a model that looks like y = (b*T+d*T^3) + (1-b-3*d*T^2)*x + (3*d*T)*x^2 + (-d)*x^3 I only have three parameters. Is nls() the right tool for the job, or is there something faster/better? /iaw Ivo Welch (ivo.we...@brown.edu,

[R] lm() with non-linear coefficients constraints? --- nls?

2010-04-29 Thread ivo welch
dear R experts---quick question. I need to estimate a model that looks like y = (b*T+d*T^3) + (1-b-3*d*T^2)*x + (3*d*T)*x^2 + (-d)*x^3 I only have three parameters. Is nls() the right tool for the job, or is there something faster/better? /iaw Ivo Welch (ivo.we...@brown.edu,

Re: [R] operator problem within function

2010-04-29 Thread David Winsemius
On Apr 29, 2010, at 9:03 AM, Bunny, lautloscrew.com wrote: Sorry for that offlist post, did not mean to do it intentionally. just hit the wrong button. Unfortunately this disadvantage is not written next to $ in the manual. Hmmm. Not my manual: Both [[ and $ select a single element of

Re: [R] Split a vector by NA's - is there a better solution then a loop ?

2010-04-29 Thread Barry Rowlingson
On Thu, Apr 29, 2010 at 1:27 PM, Henrique Dallazuanna www...@gmail.com wrote: Another option could be: split(x, replace(cumsum(is.na(x)), is.na(x), -1))[-1] One thing none of the solutions so far do (except I haven't tried Tal's original code) is insert an empty group between adjacent NA

[R] time zone convert

2010-04-29 Thread Carol Gao
Hi there, I've got a column vector in a csv file as follows, and I need to add 11 hours to each of them. Is there a way that I can do it? (The actual file size is much bigger than this.) Time 01-DEC-2008 00:00:28.611 01-DEC-2008 00:00:43.155 01-DEC-2008 00:01:06.677 01-DEC-2008 00:01:06.677

Re: [R] time zone convert

2010-04-29 Thread Henrique Dallazuanna
Try this: Time2 - gsub(\\.*, , tolower(Time)) modifyList(Time2, list(hour = Time2$hour + 11)) On Thu, Apr 29, 2010 at 10:33 AM, Carol Gao carol.g...@gmail.com wrote: Hi there, I've got a column vector in a csv file as follows, and I need to add 11 hours to each of them. Is there a way that

[R] R Anova Analysis

2010-04-29 Thread Yanwei Tan
Dear all, I have a quite basic questions about anova analysis in R, sorry for this, but I have no clue how to explain this result. I have two datasets which are named: nmda123, nmda456. Each dataset has three samples which were measured three times. And I would like to compare means of them

Re: [R] Using plyr::dply more (memory) efficiently?

2010-04-29 Thread Matthew Dowle
I don't know about that, but try this : install.packages(data.table, repos=http://R-Forge.R-project.org;) require(data.table) summaries = data.table(summaries) summaries[,sum(counts),by=symbol] Please let us know if that returns the correct result, and if its memory/speed is ok ? Matthew

[R] Simple loop code

2010-04-29 Thread RCulloch
Hi fellow R Users, I find that I typically rewrite my data specific to data in columns, which is by no means efficient and I am struggling to break out of this bad habit and utalise some of the excellent things R can do! I have tried to look at 'for' but I don't really follow it, and I wondered

[R] Changing from 32-bit builds to 64-bit builds

2010-04-29 Thread Sachi Ito
Hi, Probably this is a very simple question for all the programmers, but how do you change from 32-bit builds (default) to 64-bit builds? I've been trying to run Anova to compare two models, but I get the following error message: Error: cannot allocate vector of size 1.2 Gb R(3122,0xa0ab44e0)

Re: [R] Simple loop code

2010-04-29 Thread Henrique Dallazuanna
Try this: factor(dat.ID$ID2, labels = 1:7) On Thu, Apr 29, 2010 at 8:39 AM, RCulloch ross.cull...@dur.ac.uk wrote: Hi fellow R Users, I find that I typically rewrite my data specific to data in columns, which is by no means efficient and I am struggling to break out of this bad habit and

Re: [R] using get and paste in a loop to return objects for object names listed a strings

2010-04-29 Thread Nevil Amos
Thanks for that, the package looks very useful. It gave me the answer in a roundabout way - reminded me I needed to sue attach() so that the get () was only dealing with the objects in data.frame, rather than using the data.frame$factorname I therefore managed to sort a work around, but will

Re: [R] randomness in stepclass (klaR) or lda (MASS) ?

2010-04-29 Thread Eric Elguero
On Thu, 2010-04-29 at 15:08 +0200, Uwe Ligges wrote: Well, it is called cross validation which is based on random sampling if you do not have k=n -fold CV (=leave-one-out). Again, to get reproducible results, you will need to set a seed. thank you. I thought that leave-one-out was the

Re: [R] time zone convert

2010-04-29 Thread Carol Gao
Appreciate it! I was trying on the code you sent, then some error codes turned up: The first line runs ok, the second line: modifyList(Time2, list(hour = Time2$hour + 11)) Error in Time2$hour : $ operator is invalid for atomic vectors The time format I used for reading the Time vector is

Re: [R] time zone convert

2010-04-29 Thread Henrique Dallazuanna
Ops, I sent to you a wrong code, try this indeed: Time2 - strptime(Time, '%d-%b-%Y %H:%M:%S') modifyList(Time2, list(hour = Time2$hour + 11)) On Thu, Apr 29, 2010 at 11:14 AM, Carol Gao carol.g...@gmail.com wrote: Appreciate it! I was trying on the code you sent, then some error codes turned

Re: [R] randomness in stepclass (klaR) or lda (MASS) ?

2010-04-29 Thread Uwe Ligges
On 29.04.2010 16:04, Eric Elguero wrote: On Thu, 2010-04-29 at 15:08 +0200, Uwe Ligges wrote: Well, it is called cross validation which is based on random sampling if you do not have k=n -fold CV (=leave-one-out). Again, to get reproducible results, you will need to set a seed. thank you.

Re: [R] Compact Patricia Trees (Tries)

2010-04-29 Thread Richard Liu
Gabor, Thanks for the suggestion, I'll try it out tonight or tomorrow. Regards, Richard _ Richard R. Liu Dittingerstr. 33 CH-4053 Basel Switzerland Tel. +41 79 708 67 66 Sent from my iPhone 3GS On Apr 29, 2010, at 13:06, Gabor Grothendieck ggrothendi...@gmail.com wrote:

Re: [R] R Anova Analysis

2010-04-29 Thread Dennis Murphy
Hi: It strikes me as a little curious that the No Virus values in each of your example data sets are all *exactly* 1. Why is that? Dennis On Thu, Apr 29, 2010 at 4:52 AM, Yanwei Tan t...@nbio.uni-heidelberg.dewrote: Dear all, I have a quite basic questions about anova analysis in R, sorry

[R] merge on criteria

2010-04-29 Thread Alex Jameson
Hi, i have two files (file1.txt and file2.txt) which i would like to merge, based on certain criteria, i.e. it combines data based on matching geneID and exons. i have used the merge option, but it does not give me the desired outcome. merged.txt shows the result i would like. *File1. txt*

[R] Generalized Estimating Equation (GEE): Why is Link = Identity?

2010-04-29 Thread Sachi Ito
Hi, I'm running GEE using geepack. I set corstr = ar1 as below: m.ar - geeglm(L ~ O + A, + data = firstgrouptxt, id = id, + family = binomial, corstr = ar1) summary(m.ar) Call: geeglm(formula = L ~ O + A, family = binomial, data = firstgrouptxt, id =

Re: [R] Changing from 32-bit builds to 64-bit builds

2010-04-29 Thread Marc Schwartz
On Apr 29, 2010, at 8:56 AM, Sachi Ito wrote: Hi, Probably this is a very simple question for all the programmers, but how do you change from 32-bit builds (default) to 64-bit builds? I've been trying to run Anova to compare two models, but I get the following error message: Error:

Re: [R] Sweave question

2010-04-29 Thread Felipe Carrillo
Thanks Duncan it does exactly what I want, how do I get my options back to print graphics on computer screen? I tried options(device=screen) but didn't work.   Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish Wildlife Service California, USA - Original

Re: [R] Simple loop code

2010-04-29 Thread RCulloch
Thanks Henrique, that works! for anyone else as slow as me, just: ##Assign x - factor(dat.ID$ID2, labels = 1:7) ##Convert to dataframe x - as.data.frame(x) ##Then bind to your data z - cbind(y,x) Thanks again, I expected it to be more complicated! Cheers, Ross -- View this message in

Re: [R] time zone convert

2010-04-29 Thread Carol Gao
I tried your new lines with some random time, it seems to be working perfectly well, just as follows: z - strptime(20/2/06 23:16:16.683, %d/%m/%y %H:%M:%OS) modifyList(z, list(hour = z$hour + 11)) [1] 2006-02-21 10:16:16 Now it seems that I have some problem with my Time vector. As Time was

Re: [R] time zone convert

2010-04-29 Thread Henrique Dallazuanna
On Thu, Apr 29, 2010 at 11:44 AM, Carol Gao carol.g...@gmail.com wrote: I tried your new lines with some random time, it seems to be working perfectly well, just as follows: z - strptime(20/2/06 23:16:16.683, %d/%m/%y %H:%M:%OS) modifyList(z, list(hour = z$hour + 11)) [1] 2006-02-21

[R] EBCDIC

2010-04-29 Thread Michael Steven Rooney
Does R have package/function that can read a file that has been downloaded from a mainframe in EBCDIC format? Thanks, Mike [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

[R] Fidelity of lattice graphics captured to jpeg or png

2010-04-29 Thread Rob James
I am generating images via lattice from Frank Harrell's RMS package. These images are characterized by coloured lines and grey-scale confidence intervals. I need to port them to Openoffice/etc, and have tried both png and jpeg (at high quality), but in neither format can I subsequently see

Re: [R] time zone convert

2010-04-29 Thread Carol Gao
that's weird. I opened a new R window and paste your code, it turns up showing anz1 - data.frame(Date.G = c(01-DEC-2008, 01-DEC-2008,02-DEC-2008,03-DEC-2008,04-DEC-2008), + Time.G = c(00:03:57.398,00:04:03.778,00:04:38.639,00:04:38.639,00:04:38.639)) Time -

Re: [R] EBCDIC

2010-04-29 Thread Erik Iverson
Perhaps ?read.table, ?file, and ?iconv will offer some information about how to use different encodings in R. Michael Steven Rooney wrote: Does R have package/function that can read a file that has been downloaded from a mainframe in EBCDIC format? Thanks, Mike [[alternative HTML

Re: [R] Simple loop code

2010-04-29 Thread David Winsemius
On Apr 29, 2010, at 10:37 AM, RCulloch wrote: Thanks Henrique, that works! for anyone else as slow as me, just: ##Assign x - factor(dat.ID$ID2, labels = 1:7) ##Convert to dataframe x - as.data.frame(x) The more typical methods for converting a factor to a character vector would be:

Re: [R] Fidelity of lattice graphics captured to jpeg or png

2010-04-29 Thread Joshua Wiley
When I need high quality graphics from R, I usually use pdf or postscript. If you need a rasterized format, use a graphics editing program to rasterize at whatever quality you want (e.g., GIMP which is free). HTH, Josh On Thu, Apr 29, 2010 at 8:05 AM, Rob James r...@aetiologic.ca wrote: I am

Re: [R] Using plyr::dply more (memory) efficiently?

2010-04-29 Thread Steve Lianoglou
Hi Matthew, On Thu, Apr 29, 2010 at 9:52 AM, Matthew Dowle mdo...@mdowle.plus.com wrote: I don't know about that,  but try this : install.packages(data.table, repos=http://R-Forge.R-project.org;) require(data.table) summaries = data.table(summaries) summaries[,sum(counts),by=symbol]

[R] Fidelity of lattice graphics captured to jpeg or png... followup

2010-04-29 Thread Rob James
Subsequent investigations (via GIMP) show that the problem is in OO, and now with the images themselves. Off to the OO forums. Original Message Subject:Fidelity of lattice graphics captured to jpeg or png Date: Thu, 29 Apr 2010 08:05:04 -0700 From: Rob James

[R] generating correlated random variables from different distributions

2010-04-29 Thread Richard and Barbara Males
I need to generate a set of correlated random variables for a Monte Carlo simulation. The solutions I have found (http://www.stat.uiuc.edu/stat428/cndata.html, http://www.sitmo.com/doc/Generating_Correlated_Random_Numbers), using Cholesky Decomposition, seem to work only if the variables come

Re: [R] Split a vector by NA's - is there a better solution then a loop ?

2010-04-29 Thread Charles C. Berry
On Thu, 29 Apr 2010, Barry Rowlingson wrote: On Thu, Apr 29, 2010 at 1:27 PM, Henrique Dallazuanna www...@gmail.com wrote: Another option could be: split(x, replace(cumsum(is.na(x)), is.na(x), -1))[-1] One thing none of the solutions so far do (except I haven't tried Tal's original code)

Re: [R] merged files

2010-04-29 Thread Alex Jameson
Hi, i have two files (file1.txt and file2.txt) which i would like to merge, based on certain criteria, i.e. it combines data based on matching geneID and exons. i have used the merge option, but it does not give me the desired outcome. merged.txt shows the result i would like. *File1. txt*

[R] Tinn-R related problem

2010-04-29 Thread Maspfuhl, Oliver
Dear Mr Hewitt, I am having exactly the same problem as descibed on page https://stat.ethz.ch/pipermail/r-help/2008-March/156809.html (please find a copy below), I wonder if you happen to have heart of any solution to it (i.e. which Windows settings have to be altered in order to solve the

Re: [R] time zone convert

2010-04-29 Thread Carol Gao
Thanks! I think it now works after I changed the time zone and language settings on PC. It seems when the system was under some other languages other than english, it reads the time a bit differently. Not sure if it was the reason, but thanks for your help. Cheers, Carol On Fri, Apr 30, 2010 at

[R] Odp: convert Factor as numeric

2010-04-29 Thread Petr PIKAL
Hi You have to get rid of thousands separator firsr as.numeric(gsub(,, , S)) Regards Petr r-help-boun...@r-project.org napsal dne 29.04.2010 13:12:44: Dear group, I know this issue has been already covered, and before you reply I must say I have read the R-FAQ and search the mailing

Re: [R] time zone convert

2010-04-29 Thread David Winsemius
On Apr 29, 2010, at 10:14 AM, Carol Gao wrote: Appreciate it! I was trying on the code you sent, then some error codes turned up: The first line runs ok, the second line: modifyList(Time2, list(hour = Time2$hour + 11)) Error in Time2$hour : $ operator is invalid for atomic vectors The

Re: [R] Multiple cex sizes in main for xyplot?

2010-04-29 Thread Bert Gunter
Felix: Oh, yes. That gives me what I want without having to resort to padding parameters. I don't know why it works (vs specifying the y locations), but I suppose that's confounded with the details of lattice engineering, which I wanted to avoid. So many thanks for your help. Bert Gunter

Re: [R] Generalized Estimating Equation (GEE): Why is Link = Identity?

2010-04-29 Thread Thomas Stewart
From the GEE article in R News, Vol. 2/3, December 2002: Allows different covariates in separate models for the mean, scale, and correlation via various link functions. Geepack offers link functions for the scale, correlation, and mean models. As the output suggests, Correlation: Structure =

[R] reduce size of pdf

2010-04-29 Thread Nevil Amos
is there a way to reduce the size of pdf files in R: ? compression? lower dpi ? or some other option? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] variable importance in Random Forest

2010-04-29 Thread Changbin Du
HI, Andy, Thanks so much for your reply! IN the paper Classification and regression by randomForest, the first page, there is the random forest estimate the the importance of a variable by looking at how much prediction error increase when the variable is permuted... IN the help document of

Re: [R] Using plyr::dply more (memory) efficiently?

2010-04-29 Thread Matthew Dowle
Steve Lianoglou mailinglist.honey...@gmail.com wrote in message news:t2ybbdc7ed01004290812n433515b5vb15b49c170f5a...@mail.gmail.com... Thanks for directing me to the data.table package. I read through some of the vignettes, and it looks quite nice. While your sample code would provide

Re: [R] Can't load doSMP from REvolutionR in regular R2.11.0

2010-04-29 Thread David M Smith
We haven't tested doSMP with the mingw compiler (hence why we haven't yet submitted it to CRAN). We compiled it under R 2.10 using the same Intel compilers we use for REvolution R. It is open source (GPL) so you're welcome to try compiling it under mingw yourself, but we can't offer support for

Re: [R] Using plyr::dply more (memory) efficiently?

2010-04-29 Thread Steve Lianoglou
Hi Matthew, Sounds like its working,  but could you give us an idea whether it is quick and memory efficient ? I actually can't believe what I'm seeing, I just recoded the function to use data.table. What has taken something on the order of ~ 20-30mins with an lapply/do.call(rbind, ...) combo

Re: [R] merged files

2010-04-29 Thread David Winsemius
On Apr 29, 2010, at 10:21 AM, Alex Jameson wrote: Hi, i have two files (file1.txt and file2.txt) which i would like to merge, based on certain criteria, i.e. it combines data based on matching geneID and exons. i have used the merge option, Huh? What is the merge option? (There is a

Re: [R] reduce size of pdf

2010-04-29 Thread Greg Snow
It would help if we knew how big your pdf is and why it is big. Can you show an example or at least describe the process used to generate the file and what you goals are in creating/displaying the file? -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare

[R] How to extract data table

2010-04-29 Thread ericyujin99
I'm a very new user of R, The problem I got is when I have lots of data table, 3 columns and 100 rows assigned to a variable x. how can I transform the table into a external file excel or other files without losing any information. So that make the data look nicer. -- View this message in

Re: [R] Split a vector by NA's - is there a better solution then a loop ?

2010-04-29 Thread Thomas Stewart
Or, you can modify Romain's function to account for sequential NAs. x - c(1,2,NA,1,1,2,NA,NA,4,5,2,3) foo - function( x ){ idx - 1 + cumsum( is.na( x ) ) not.na - ! is.na( x ) f-factor(idx[not.na],levels=1:max(idx)) split( x[not.na], f ) } $`1` [1] 1 2 $`2` [1] 1 1 2 $`3`

Re: [R] operator problem within function

2010-04-29 Thread Bunny, lautloscrew.com
Nice, thx. Which manual do you use ? an introduction to R ? Or something special ? matt On 29.04.2010, at 15:25, David Winsemius wrote: On Apr 29, 2010, at 9:03 AM, Bunny, lautloscrew.com wrote: Sorry for that offlist post, did not mean to do it intentionally. just hit the wrong

[R] how to parse out fitting statistics and write them into a data frame?

2010-04-29 Thread weix1
hello, everyone: I am conducting t test between drug and control for about 50,000 gene using the following syntax (treatment is factor): result- lapply(split(data, data$gene),function(x) lm(value~treatment,x) however, the result is a list and i do not know whether more model fitting

Re: [R] operator problem within function

2010-04-29 Thread David Winsemius
That was copied from the help page the comes up with: ?$ It is rather special. -- David. On Apr 29, 2010, at 12:26 PM, Bunny, lautloscrew.com wrote: Nice, thx. Which manual do you use ? an introduction to R ? Or something special ? matt On 29.04.2010, at 15:25, David Winsemius

  1   2   >