Re: [R] Building Hmisc
Hi Kevin, I can't help with your problem. Sorry, but I am interested to learn how you compiled Hmisc package because I need to use it, too. Thank you, Klaus -- View this message in context: http://r.789695.n4.nabble.com/Building-Hmisc-tp2076375p2076530.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to replace all non-maximum values in a row with 0
Thanks for advice, sorted now! From: Dennis Murphy [via R] ml-node+1819620-944858377-225...@n4.nabble.com Sent: Sat, 10 April, 2010 2:18:33 Subject: Re: How to replace all non-maximum values in a row with 0 Hi: This isn't much shorter than the previous solution, but here's another take, operating row-wise. A - matrix (c(2, 3, 0, 0, 200, 30, 0, 0, 2, 50, 0, 0, 3, 0, 0, 0, 0, 8, 8, 0), nrow = 4, byrow=T) # Write a vector function to apply to each row: begin by initializing a zero # vector of length = no. columns. Next, find which indices of the row vector x # match the maximum. If that number is 1, return a zero vector, else replace # the index where the maximum resides to 1. f - function(x) { o - rep(0, length(x)) w - which(x == max(x)) r - if(length(w) 1) {o} else { o[w] - 1; o} r } # Test: t(apply(A, 1, f)) [,1] [,2] [,3] [,4] [,5] [1,]00001 [2,]00001 [3,]00100 [4,]00000 HTH, Dennis On Fri, Apr 9, 2010 at 1:04 AM, burgundy [hidden email] wrote: Hi, I would like to replace all the max values per row with 1 and all other values with 0. If there are two max values, then 0 for both. Example: from: 2 3 0 0 200 30 0 0 2 50 0 0 3 0 0 0 0 8 8 0 to: 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 Thanks! -- View this message in context: http://n4.nabble.com/How-to-replace-all-non-maximum-values-in-a-row-with-0-tp1819018p1819018.html Sent from the R help mailing list archive at Nabble.com. __ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. View message @ http://n4.nabble.com/How-to-replace-all-non-maximum-values-in-a-row-with-0-tp1819018p1819620.html To unsubscribe from How to replace all non-maximum values in a row with 0, click here. -- View this message in context: http://r.789695.n4.nabble.com/How-to-replace-all-non-maximum-values-in-a-row-with-0-tp1819018p2076545.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to replace all non-maximum values in a row with 0
Thanks for advice, sorted now! From: Owe Jessen-2 [via R] ml-node+1819075-790408820-225...@n4.nabble.com Sent: Fri, 9 April, 2010 18:39:53 Subject: Re: How to replace all non-maximum values in a row with 0 Am 09.04.2010 10:04, schrieb burgundy: Hi, I would like to replace all the max values per row with 1 and all other values with 0. If there are two max values, then 0 for both. Example: from: 2 3 0 0 200 30 0 0 2 50 0 0 3 0 0 0 0 8 8 0 to: 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 Thanks! Nice little homework to get the day started. :-) This worked for me, but is probably not the shortest possible answer A - matrix (c(2, 3, 0, 0, 200, 30, 0, 0, 2, 50, 0, 0, 3, 0, 0, 0, 0, 8, 8, 0), nrow = 4, byrow=T) nr - nrow(A) nc - ncol(A) B - matrix(0,nrow=nr, ncol=nc) for(i in 1:nr){ x - which(A[i,]==max(A[i,])) B[i,x] - 1 if(sum(B[i,])1) B[i,] - as.vector(rep(0,nc)) } -- Owe Jessen Nettelbeckstr. 5 24105 Kiel [hidden email] http://privat.owejessen.de __ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. View message @ http://n4.nabble.com/How-to-replace-all-non-maximum-values-in-a-row-with-0-tp1819018p1819075.html To unsubscribe from How to replace all non-maximum values in a row with 0, click here. -- View this message in context: http://r.789695.n4.nabble.com/How-to-replace-all-non-maximum-values-in-a-row-with-0-tp1819018p2076546.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] any feedback on XL Solutions Courses for R?
On 4/30/10, Dimitri Liakhovitski ld7...@gmail.com wrote: I can only provide feedback on one and only course I participated in. It was 3 years ago. It was for R beginners. And I guess, we did not get lucky - the person who was sent was not a good instructor. Our boss at the company I was working for at the time (who is very good with R) ended up answering all our questions while the instructor looked helpless. Of course, it's possible that they anticipated more advanced audience - but still it was not good. Bear in mind - it's a sample size of ONE. (I never took their classes.) To make it two, I was never impressed by their site and announcements. It all seemed so unprofessional. Bit of off-topic, but I like fortune(xl). Liviu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] getting random integers
On Thu, Apr 29, 2010 at 12:43:42PM -0400, Sarah Goslee wrote: You can always take a look. If you use a much bigger sample size it will be obvious: hist(round(runif(100, min = 1, max = 10))) Thank for this advice, apparently 1 and 10 had not the same chances of being selected. I'd use instead: hist(sample(1:10, 100, replace=TRUE)) sample() is what I want, thank you. -- Hans Ekbrand (http://sociologi.cjb.net) h...@sociologi.cjb.net signature.asc Description: Digital signature __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] read.csv and blank character in object name of my data.frame
Dear group, Here is my data frame: position100415 - structure(list(DESCRIPTION = structure(1:9, .Label = c( SUGAR NO.11 Jul/10 , SUGAR NO.11 May/10 , CORN May/10 , COTTON NO.2 Jul/10 , CRUDE OIL miNY May/10 , ROBUSTA COFFEE (10) Jul/10 , SILVER May/10 , SOYBEANS Jul/10 , WHEAT May/10 ), class = factor), POSITION = c(3, -1, 3, 4, 3, 10, 1, 1, 6), SETTLEMENT = c(17.08, 16.85, 363.25, 82.12, 85.51, 1386, 1843.3, 993, 480.25)), .Names = c(DESCRIPTION, POSITION, SETTLEMENT), row.names = c(NA, 9L), class = data.frame) As you can see, I have a blank at the end of each name of objects of list DESCRIPTION (e.g COTTON NO.2 Jul/10_,. I need to remove them. My data frame has been obtained from a .csv file and then a few command lines. Here is the first line of my code : pose=read.csv2(LSCPos100415.csv,sep=,,dec=.,as.is=T,h=T,skip=1)[,c(4,8 ,14,15)] As you can see, the blank already exists (e.g CORN May/10_), so it should come from the Excel file itself. pose - structure(list(DESCRIPTION = c(CORN May/10 , CORN May/10 , SOYBEANS Jul/10 , WHEAT May/10 , WHEAT May/10 , WHEAT May/10 , WHEAT May/10 , WHEAT May/10 , WHEAT May/10 , COTTON NO.2 Jul/10 , COTTON NO.2 Jul/10 , SUGAR NO.11 Jul/10 , SUGAR NO.11 Jul/10 , SUGAR NO.11 Jul/10 , SUGAR NO.11 May/10 , CRUDE OIL miNY May/10 , CRUDE OIL miNY May/10 , ROBUSTA COFFEE (10) Jul/10 , ROBUSTA COFFEE (10) Jul/10 , ROBUSTA COFFEE (10) Jul/10 , ROBUSTA COFFEE (10) Jul/10 , ROBUSTA COFFEE (10) Jul/10 , ROBUSTA COFFEE (10) Jul/10 , ROBUSTA COFFEE (10) Jul/10 , ROBUSTA COFFEE (10) Jul/10 , ROBUSTA COFFEE (10) Jul/10 , SILVER May/10 , PRM HGH GD ALUMINIUM USD 09/07/10 , PRM HGH GD ALUMINIUM USD 09/07/10 , PRIMARY NICKEL USD 04/06/10 , PRIMARY NICKEL USD 04/06/10 , PRIMARY NICKEL USD 10/06/10 , PRIMARY NICKEL USD 10/06/10 , STANDARD LEAD USD 01/07/10 , STANDARD LEAD USD 01/07/10 , STANDARD LEAD USD 01/07/10 , STANDARD LEAD USD 01/07/10 , STANDARD LEAD USD 01/07/10 , STANDARD LEAD USD 01/07/10 , STANDARD LEAD USD 01/07/10 , STANDARD LEAD USD 06/07/10 , STANDARD LEAD USD 19/04/10 , STANDARD LEAD USD 19/04/10 , STANDARD LEAD USD 22/06/10 , STANDARD LEAD USD 23/06/10 , STANDARD LEAD USD 23/06/10 , STANDARD LEAD USD 23/06/10 , STANDARD LEAD USD 25/06/10 , STANDARD LEAD USD 25/06/10 , STANDARD LEAD USD 29/06/10 , STANDARD LEAD USD 29/06/10 , SPCL HIGH GRADE ZINC USD 06/07/10 , SPCL HIGH GRADE ZINC USD 06/07/10 , SPCL HIGH GRADE ZINC USD 06/07/10 , SPCL HIGH GRADE ZINC USD 06/07/10 , SPCL HIGH GRADE ZINC USD 06/07/10 , SPCL HIGH GRADE ZINC USD 06/07/10 , SPCL HIGH GRADE ZINC USD 06/07/10 , SPCL HIGH GRADE ZINC USD 07/07/10 , SPCL HIGH GRADE ZINC USD 07/07/10 , SPCL HIGH GRADE ZINC USD 07/07/10 , SPCL HIGH GRADE ZINC USD 08/07/10 , SPCL HIGH GRADE ZINC USD 08/07/10 , SPCL HIGH GRADE ZINC USD 08/07/10 , SPCL HIGH GRADE ZINC USD 09/07/10 , SPCL HIGH GRADE ZINC USD 09/07/10 , SPCL HIGH GRADE ZINC USD 09/07/10 , SPCL HIGH GRADE ZINC USD 09/07/10 , SPCL HIGH GRADE ZINC USD 09/07/10 , SPCL HIGH GRADE ZINC USD 13/07/10 , SPCL HIGH GRADE ZINC USD 13/07/10 , SPCL HIGH GRADE ZINC USD 14/07/10 , SPCL HIGH GRADE ZINC USD 14/07/10 , SPCL HIGH GRADE ZINC USD 14/07/10 , SPCL HIGH GRADE ZINC USD 14/07/10 , SPCL HIGH GRADE ZINC USD 15/07/10 , SPCL HIGH GRADE ZINC USD 15/07/10 , SPCL HIGH GRADE ZINC USD 15/07/10 , SPCL HIGH GRADE ZINC USD 15/07/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 18/05/10 , SPCL HIGH GRADE ZINC USD 18/05/10 , SPCL HIGH GRADE ZINC USD 18/05/10 , SPCL HIGH GRADE ZINC USD 18/05/10 , SPCL HIGH GRADE ZINC USD 18/05/10 , SPCL HIGH GRADE ZINC USD 19/04/10 , SPCL HIGH GRADE ZINC USD 19/04/10 , SPCL HIGH GRADE ZINC USD 19/04/10 , SPCL HIGH GRADE ZINC USD 19/04/10 , SPCL HIGH GRADE ZINC USD 19/05/10 , SPCL HIGH GRADE ZINC USD 20/04/10 , SPCL HIGH GRADE ZINC USD 20/04/10 , SPCL HIGH GRADE ZINC USD 21/04/10 , SPCL HIGH GRADE ZINC USD 21/04/10 , SPCL HIGH GRADE ZINC USD 21/05/10 , SPCL HIGH GRADE ZINC USD 21/05/10 , SPCL HIGH GRADE ZINC USD 21/05/10 , SPCL HIGH GRADE ZINC USD 21/05/10 , SPCL HIGH GRADE ZINC USD 21/05/10 , SPCL HIGH GRADE ZINC USD 21/05/10 , SPCL HIGH GRADE ZINC USD 21/05/10 , SPCL HIGH GRADE ZINC USD 22/04/10 , SPCL HIGH GRADE ZINC USD 22/04/10 , SPCL HIGH GRADE ZINC USD 22/04/10 , SPCL HIGH GRADE ZINC USD 22/04/10 , SPCL HIGH GRADE ZINC USD 22/06/10 , SPCL HIGH GRADE ZINC USD 22/06/10 , SPCL HIGH GRADE ZINC USD 24/05/10 , SPCL HIGH GRADE ZINC USD 24/05/10 , SPCL HIGH GRADE ZINC USD 24/05/10 ,
[R] How to generate a distance matrix?
Hi, I'm trying to generate a distance matrix between sample pairs (example below). I'm not very familiar with the loop command which I expect I will need for this. The example below demosntrates what I'd like to get out of the data - essentially, to calculate the proportion of positions where two samples differ. Any help much appreciated! Also, any notes on how the functions work would be great! Thanks! Example input (note: comma indicates column separators, a:d are sample names): a,1,2,4,4 b,2,1,4,4 c,1,2,3,4 d,1,0,4,0 Identify positions which differ between pairwise comparisons of samples a:d (score 1 for differ, 0 for shared in example below) some comparisons are duplicates, e.g. ab and ba, and self-comparisons such as aa or bb are obviously all 1, but these are neccessary to make the matrix aa,1,1,1,1 ab,1,1,0,0 ac,0,0,1,0 ad,0,1,0,1 ba,1,1,0,0 bb,1,1,1,1 bc,1,1,1,0 etc... to dd Calculate proportion of differing positions between pairwise comparisons aa,0 ab,0.5 ac,0.25 ad,0.5 ba,0.5 bb,0 bc,0.75 etc...to dd prepare matrix (e.g. ab value plotted in [a,b]; ba value plotted in [b,a] etc...) a,b,c,d a,0,0.5,0.25,0.5 b,0.5,0,0.75 etc... c d -- View this message in context: http://r.789695.n4.nabble.com/How-to-generate-a-distance-matrix-tp2076600p2076600.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] X11() device widht and height parameters limited to one screen
Hi, if I specify the width and height of a plot I want to see via X11(width=14,height=7) X11(width=28,height=14) X11(width=20,height=14) X11(width=13,height=14) X11(width=15,height=14) any width greater than 15 is ignored as it seems the width is limited by the screen width. However, as I am using two screens (xinerama), I can easily manually resize to fit two screens. Is there a way to get it to be wider than one screen width via the X11 call? Is there something else I am doing wrong? Thanks for your help! Florian __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Find solution for an error in the condition of if
Dear r-help, Could you help me to find a solution for this error: Il y a eu 50 avis ou plus (utilisez warnings() pour voir les 50 premiers) warnings() Messages d'avis : 1: In if ((data[pa, k] == df[, j]) (data[ch, k] == i)) { ... : la condition a une longueur 1 et seul le premier élément est utilisé 2: In if ((data[pa, k] == df[, j]) (data[ch, k] == i)) { ... : la condition a une longueur 1 et seul le premier élément est utilisé ch=3 pa=c(1,2) r=2 t=4 nb=15 ni=array(0,c( r,t)) for ( i in 1:r){ for (j in 1:t ){ for (k in 1:nb){ if ( (data[pa,k]== df[,j]) (data[ch,k]==i)){ ni[i,j]=ni[i,j]+1 } } } } Best Regards [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to generate a distance matrix?
Wouldn't the ?dist function help you ? 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) -- On Fri, Apr 30, 2010 at 11:12 AM, burgundy saub...@yahoo.com wrote: Hi, I'm trying to generate a distance matrix between sample pairs (example below). I'm not very familiar with the loop command which I expect I will need for this. The example below demosntrates what I'd like to get out of the data - essentially, to calculate the proportion of positions where two samples differ. Any help much appreciated! Also, any notes on how the functions work would be great! Thanks! Example input (note: comma indicates column separators, a:d are sample names): a,1,2,4,4 b,2,1,4,4 c,1,2,3,4 d,1,0,4,0 Identify positions which differ between pairwise comparisons of samples a:d (score 1 for differ, 0 for shared in example below) some comparisons are duplicates, e.g. ab and ba, and self-comparisons such as aa or bb are obviously all 1, but these are neccessary to make the matrix aa,1,1,1,1 ab,1,1,0,0 ac,0,0,1,0 ad,0,1,0,1 ba,1,1,0,0 bb,1,1,1,1 bc,1,1,1,0 etc... to dd Calculate proportion of differing positions between pairwise comparisons aa,0 ab,0.5 ac,0.25 ad,0.5 ba,0.5 bb,0 bc,0.75 etc...to dd prepare matrix (e.g. ab value plotted in [a,b]; ba value plotted in [b,a] etc...) a,b,c,d a,0,0.5,0.25,0.5 b,0.5,0,0.75 etc... c d -- View this message in context: http://r.789695.n4.nabble.com/How-to-generate-a-distance-matrix-tp2076600p2076600.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Find solution for an error in the condition of if
Dear Nuel, could you send the error messages in English please. Adds between the two conditions and try again if ( (data[pa,k]== df[,j]) (data[ch,k]==i)) Best M anderson nuel a écrit : Dear r-help, Could you help me to find a solution for this error: Il y a eu 50 avis ou plus (utilisez warnings() pour voir les 50 premiers) warnings() Messages d'avis : 1: In if ((data[pa, k] == df[, j]) (data[ch, k] == i)) { ... : la condition a une longueur 1 et seul le premier élément est utilisé 2: In if ((data[pa, k] == df[, j]) (data[ch, k] == i)) { ... : la condition a une longueur 1 et seul le premier élément est utilisé ch=3 pa=c(1,2) r=2 t=4 nb=15 ni=array(0,c( r,t)) for ( i in 1:r){ for (j in 1:t ){ for (k in 1:nb){ if ( (data[pa,k]== df[,j]) (data[ch,k]==i)){ ni[i,j]=ni[i,j]+1 } } } } Best Regards [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Mohamed Lajnef,IE INSERM U955 eq 15 Pôle de Psychiatrie Hôpital CHENEVIER 40, rue Mesly 94010 CRETEIL Cedex FRANCE mohamed.laj...@inserm.fr tel : 01 49 81 31 31 (poste 18470) Sec : 01 49 81 32 90 fax : 01 49 81 30 99 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] X11() device widht and height parameters limited to one screen
On Fri, Apr 30, 2010 at 8:53 AM, Florian Burkart florian.burk...@whu.edu wrote: Hi, if I specify the width and height of a plot I want to see via X11(width=14,height=7) X11(width=28,height=14) X11(width=20,height=14) X11(width=13,height=14) X11(width=15,height=14) any width greater than 15 is ignored as it seems the width is limited by the screen width. However, as I am using two screens (xinerama), I can easily manually resize to fit two screens. Is there a way to get it to be wider than one screen width via the X11 call? Is there something else I am doing wrong? help(X11) says: The initial size and position are only hints, and may not be acted on by the window manager. Also, some systems (especially laptops) are set up to appear to have a screen of a different size to the physical screen. so the chances are it's your window manager overriding the hints. I had a similar problem yesterday with my Ubuntu Karmic Koala dual-screen box (you didn't say what OS exactly you've got). Trying to resize an OpenOffice Draw window over both screens was a pain, it kept snapping back to one screen. I could make it larger than one screen by slowly moving and resizing it a bit at a time, but one false move.. and SNAP! Back to one screen. Grr. See if you have similar problem resizing other applications, and then check your window manager settings. Somewhere in the nest of my Compiz Config Manager, amongst the 3d desktop cube, wobbling windows, and rain-on-my-screen effects, is something that is snapping away at me. Barry __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] operator problem within function
lol. you´re right, the is special. On 29.04.2010, at 18:34, David Winsemius wrote: 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 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 button. Unfortunately this disadvantage is not written next to $ in the manual. Hmmm. Not my manual: Both [[ and $ select a single element of the list. The main difference is that $ does not allow computed indices, whereas [[does. It also says that the correct equivalent using extraction operators of $ would be: x$name == x[[name, exact = FALSE]] -- David. On Apr 29, 2010, at 2:34 AM, Bunny, lautloscrew.com wrote: David, With your help i finally got it. THX! sorry for handing out some ugly names. Reason being: it´s a german dataset with german variable names. With those german names you are always sure you dont use a forbidden name. I just did not want to hit one of those by accident when changing these names for the mailing list. columna is just the latin term for column :) . Anyway here´s what worked note: I just tried to use some more real names here. recode_items = function(dataframe,question_number,medium=3){ #note column names of the initial data.frame are like Question1,Question2 etc. Using [,1] would not be very practical since # the df contains some other data too. Indexing by names seemed to most comfortable way so far. question-paste(Question,question_number,sep=) # needed indexing here that understands characters, that´s why going with [,question_number] did not work. dataframe[question][dataframe[question]==3]=0 This would be more typical: dataframe[dataframe[question]==3, question] - 0 return(dataframe) } recode_items(mydataframe,question_number,3) # this call uses the dataframe that contains the answers of survey participants. Question number is an argument that selects the question from the dataframe that should be recoded. In surveys some weighting schemes only respect extreme answers, which is why the medium answer is recoded to zero. Since it depends on the item scale what medium actually is, I need it to be an argument of my function. Did you want a further logical test with that =1 or some sort of assignment??? So yes, it´s an assignment. Moral: Generally better to use [ indexing. That´s what really made my day (and it´s only 9.30 a.m. here ) . Are there exceptions to rule? Not that I know of. I just worked a lot with the $ in the past. $colname is just syntactic sugar for either [colname] or [ ,colname] and it has the disadvantage that colname is not evaluated. thx matt On 29.04.2010, at 00:56, David Winsemius wrote: On Apr 28, 2010, at 5:45 PM, David Winsemius wrote: On Apr 28, 2010, at 5:31 PM, Bunny, lautloscrew.com wrote: Dear all, i have a problem with processing dataframes within a function using the $. Here´s my code: recode_items = function(dataframe,number,medium=2){ # this works q-paste(columna,number,sep=) Do your really want q to equal columna2 when number equals 2? # this does not work, particularly because dataframe is not processed # dataframe should be: givenframe$columnagivennumber a=dataframe$q[dataframe$q==medium]=1 Did you want a further logical test with that =1 or some sort of assignment??? a) Do you want to work on the column from dataframe ( horrible name for this purpose IMO) with the name columna2? If so, then start with dataframe[ , q ] the q will be evaluated in this form whereas it would not when used with $. b) (A guess in absence of explanation of a goal.) Now do you want all of the rows where that vector equals medium? If so ,then try this: dataframe[ dataframe[ , q ]==2 , ] # untested in the absence of data Ooops. should have been: dataframe[ dataframe[ , q ]==medium , ] #since both q and medium will be evaluated. Moral: Generally better to use [ indexing. -- David. return(a) } If I call this function, i´d like it to return my dataframe. The problem appears to be somewhere around the $. I´m sure this not too hard, but somehow i am stuck. I´ll keep searchin the manuals. Thx for any help in advance. best matt [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting
Re: [R] Find solution for an error in the condition of if
On 30/04/2010 4:19 AM, anderson nuel wrote: Dear r-help, Could you help me to find a solution for this error: Il y a eu 50 avis ou plus (utilisez warnings() pour voir les 50 premiers) warnings() Messages d'avis : 1: In if ((data[pa, k] == df[, j]) (data[ch, k] == i)) { ... : la condition a une longueur 1 et seul le premier élément est utilisé It's saying that the condition has length 1 and only the first element is used. This is probably coming from the first part of the test: data[pa,k] will be scalar, but df[,j] looks like a vector of every element in column j. The result is a vector with as many entries as you have rows in df. Only the first of them will be compared to data[pa, k]. Duncan Murdoch 2: In if ((data[pa, k] == df[, j]) (data[ch, k] == i)) { ... : la condition a une longueur 1 et seul le premier élément est utilisé ch=3 pa=c(1,2) r=2 t=4 nb=15 ni=array(0,c( r,t)) for ( i in 1:r){ for (j in 1:t ){ for (k in 1:nb){ if ( (data[pa,k]== df[,j]) (data[ch,k]==i)){ ni[i,j]=ni[i,j]+1 } } } } Best Regards [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] image function with date-time on X axis
Thanks Peter zlevs and ylevs are similar, that was not the problem Following your suggestion I now use image(tax, ylevs, Rmat, xaxt = n) axis.POSIXct(1, at = seq(tax[1],tax[length(tax)],by=1 day),format=%d-%m) Which does what I wanted to do I still get the warning message, but otherwise this works. Thanks again Halldór On Fri, Apr 30, 2010 at 2:05 AM, Peter Ehlers ehl...@ucalgary.ca wrote: On 2010-04-29 12:15, Halldór Björnsson wrote: I am trying to plot a image where the x axis has the units of time. When I issue the image(x,y,z) command with x as a POSIXct object, it fails to put a time stamp on the x axis. Instead I get a warning Incompatible methods warning and no dates on my x axis. This example shows my problem: Rmat=t(matrix(data=rnorm(1:500),ncol=10,nrow=50)) tax=seq(ISOdate(2010,4,14,12,0,0), ISOdate(2010,4,19,00,0,0), by = 12 hours) ylevs=seq(100,5000,length=50) image(tax,ylevs,Rmat) This givies the warning: In image.default(tax, zlevs, Rmat) : Incompatible methods (-.POSIXt, Ops.difftime) for - 2: In is.vector(X) : I don't get that warning. Are you doing something you're not telling us? (I note that you have 'ylevs' in one place and 'zlevs' in another). This works for me (using your above definitions of Rmat, etc): image(tax, ylevs, Rmat, xaxt = n) axis(1, at = as.numeric(tax), lab = weekdays(tax, TRUE)) -Peter Ehlers Contrast the x axis result of image with that of plot plot(tax,rnorm(length(tax))) where the date-time shows stamps work fine. How can I get image to behave (or is there a better function for the job?) Sincerely Halldór __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Peter Ehlers University of Calgary __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Dynamische Programmierung mit R
Guten Tag, ich bin ein Neuanwender von R und möchte im Rahmen meiner Forschung den Algorithmus von Longstaff/Schwartz in R umsetzen. Hierfür möchte ich in Erfahrung bringen, ob in R das Prinzip der dynamischen Programmierung umsetzbar ist und ob es dafür vielleicht schon ähnliche Programme gibt, auf denen ich aufbauen könnte. Für eine Rückantwort wäre ich sehr dankbar. Freundliche Grüße, Marc [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Dynamische Programmierung mit R
Hi Marc, this list speaks English please. For all others: Marc wants to implement the algorithm of Langstaff/Schwartz via dynamic programming. He asks whether this could be done in R and whether there are good examples for existing dynamic programming functions in R. First, this fortune holds: R fortune(Yoda) Evelyn Hall: I would like to know how (if) I can extract some of the information from the summary of my nlme. Simon Blomberg: This is R. There is no if. Only how. -- Evelyn Hall and Simon 'Yoda' Blomberg R-help (April 2005) So, yes, you can do dynamic programming. There are also examples for this, for example the breakpoints() function (or rather its formula method). However, the function is very specific to the problem of breakpoint estimation and probably not suitable as a role model for general dynamic programming. hth, Z On Fri, 30 Apr 2010, Marc Hanfeld wrote: Guten Tag, ich bin ein Neuanwender von R und m?chte im Rahmen meiner Forschung den Algorithmus von Longstaff/Schwartz in R umsetzen. Hierf?r m?chte ich in Erfahrung bringen, ob in R das Prinzip der dynamischen Programmierung umsetzbar ist und ob es daf?r vielleicht schon ?hnliche Programme gibt, auf denen ich aufbauen k?nnte. F?r eine R?ckantwort w?re ich sehr dankbar. Freundliche Gr??e, Marc [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Something similar to loess for 2D curves?
Hello, I have been struggling to find something similar to loess for 2D curves. I have a number of 2D curves t --- (x(t), y(t)) with some noise that I want to filter out. There may also be some (very few) obvious outliers in the data. Mind that these are not x - y(x) functions, as neither coordinate is monotone. Because of noise, they might not even be locally monotone. I have seen some papers on fitting Bezier curves (possibly several of them) but I rather use something more loess-like, so that I can: 1) Fit a model to the raw curve. 2) Check the residuals in order to detect possible outliers and interpolate in those points. I used two independent loess smoothers on the individual coordinates, but the results were not satisfactory as the correlation between both coordinates was ignored. Any ideas? Best regards, Carlos J. Gil Bellosta http://www.datanalytics.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Curve Fitting/Regression with Multiple Observations
Dear Keith, Thanks for the suggestion and taking your time to respond to it. But, you misunderstand something and seems that you do not read all my previous e-mails. For instance, can a hand-drawing curve give you an inverse function (analytically or numerically) so that you can find an x value given the y value (not just for one, but for hundreds of points)? As for the statistical inferences, I admit that my communications were not that very clear. My intention is to get a smoothed curve from the simulation data in a statistically meaningful way as much as possible for my intended use of the resulting curve. As said before, I don't know all the thorough theoretical details behind regression and curve fitting functions available in R (know the basics though as one with PhD in Elec. Eng. unlike someone's assessment), but am doing my best to catch up reading textbooks and manuals, and posting this question to this list is definitely a way to learn from many experts and advanced users of R. By the way, I wonder why most of the responses I've received from this list are so cynical (or skeptical?) and in some sense done in a quite arrogant way. It's very hard to imagine that one would receive such responses in my own areas of computer simulation and optical communications/networking. If a newbie asks a question to the list not making much sense or another FAQ, that is usually ignored (i.e., no response) because all we are too busy to deal with that. Sometimes, though, a kind soul (like Gabor) takes his/her own valuable time and doesn't mind explaining all the details from simple basics. Again, what I want to hear from the list is the proper use of regression/curve fitting functions of R for my simulation data with replications: Applying after taking means or directly on them? So far I haven't heard anyone even specifically touching my question, although there were several seemingly related suggestions. Regards, Joseph On Fri, Apr 30, 2010 at 4:25 AM, kMan kchambe...@gmail.com wrote: Dear Joseph, If you do not need to make any inferences, that is, you just want it to look pretty, then drawing a curve by hand is as good a solution as any. Plus, there is no reason for expert testimony to say that the curve does not mean anything. Sincerely, KeithC. -Original Message- From: Kyeong Soo (Joseph) Kim [mailto:kyeongsoo@gmail.com] Sent: Tuesday, April 27, 2010 2:33 PM To: Gabor Grothendieck Cc: r-help@r-project.org Subject: Re: [R] Curve Fitting/Regression with Multiple Observations Frankly speaking, I am not looking for such a framework. The system I'm studying is a communication network (like M/M/1 queue, but way too complicated to mathematically analyze it using classical queueing theory) and the conclusion I want to make is qualitative rather than quantatitive -- a high-level comparative study of various network architectures based on the equivalence principle (a concept specific to netwokring, not in the general sense). What l want in this regard is a smooth, non-decreasing (hence one-to-one) function built out of simulation data because later in my processing, I need an inverse function of the said curve to find out an x value given the y value. That was, in fact, the reason I used the exponential (i.e., non-decreasing function) curve fiting. Even though I don't need a statistical inference framework for my work, I want to make sure that my use of regression/curve fitting techniques with my simulation data (as a tool for getting the mentioned curve) is proper and a usual practice among experts like you. To get answer to my question, I digged a lot through the Internet but found no clear explanation so far. Your suggestions and providing examples (always!) are much appreciated, but I am still not sure the use of those regression procedures with the kind of data I described is a right way to do. Again, many thanks for your prompt and kind answers, Joseph On Tue, Apr 27, 2010 at 8:46 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: If you are looking for a framework for statistical inference you could look at additive models as in the mgcv package which has a book associated with it if you need more info. e.g. library(mgcv) fm - gam(dist ~ s(speed), data = cars) summary(fm) plot(dist ~ speed, cars, pch = 20) fm.ci - with(predict(fm, se = TRUE), cbind(0, -2*se.fit, 2*se.fit) + c(fit)) matlines(cars$speed, fm.ci, lty = c(1, 2, 2), col = c(1, 2, 2)) On Tue, Apr 27, 2010 at 3:07 PM, Kyeong Soo (Joseph) Kim kyeongsoo@gmail.com wrote: Hello Gabor, Many thanks for providing actual examples for the problem! In fact I know how to apply and generate plots using various R functions including loess, lowess, and smooth.spline procedures. My question, however, is whether applying those procedures directly on the data with multiple observations/duplicate points(?) is on the sound basis or not. Before asking
[R] apply fun to df returning a matrix
Hello, a data.frame, df, holds the numerics, x, y, and z. A function, fun, should return some arbitrary statistics about the arguments, e.g. the sum or anything else. What I want to do is to apply this function to every pair of variables in df, and the return should be a matrix as found with cov. How can I achieve that? Thanks, Sören df - data.frame(x=1:10, y=11:20, z=21:30); fun - function(x){ return(sum(x)); } # and now??? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] apply fun to df returning a matrix
Hi Soeren Apply or aggregate functions best regards M soeren.vo...@eawag.ch a écrit : Hello, a data.frame, df, holds the numerics, x, y, and z. A function, fun, should return some arbitrary statistics about the arguments, e.g. the sum or anything else. What I want to do is to apply this function to every pair of variables in df, and the return should be a matrix as found with cov. How can I achieve that? Thanks, Sören df - data.frame(x=1:10, y=11:20, z=21:30); fun - function(x){ return(sum(x)); } # and now??? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Mohamed Lajnef,IE INSERM U955 eq 15 Pôle de Psychiatrie Hôpital CHENEVIER 40, rue Mesly 94010 CRETEIL Cedex FRANCE mohamed.laj...@inserm.fr tel : 01 49 81 31 31 (poste 18470) Sec : 01 49 81 32 90 fax : 01 49 81 30 99 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Building Hmisc
On 30.04.2010 02:10, rkevinbur...@charter.net wrote: From the notes I see that for 2.11 Hmisc is not supported and the suggestion is made to build from source. I am on a Windows 7 platform and I got all of the tools and successfully built 'R' from source. I changed to gnuwin32 and entered make all recommended. Even though the tar.gz (source) version of Hmisc has been downloaded and placed in library/recommended folder the build process doesn't seem to pick it up. What do I need to do to build this from source? Right now whenever I start R I get the error: Hmsic is not among the recommended packages that are shiped with R, hence you cannot install it that way. See the manual R Installation and Administration how to do it. My forecast is that a binary of a fixed Hmisc will be available next week. Best, Uwe Ligges Error: package 'Hmisc' could not be loaded In addition: Warning message: In library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc) : there is no package called 'Hmisc' And I cannot run anything. Thank you for the suggestions. Kevin __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] reduce size of pdf
Dear Nevil, Converting your pdf to png will be the most efficient way to reduce the file size with scatter plots. You can either export directly to pdf or first create a pdf and then use ghostscript to convert it into png. I tend to the the latter because it is easier to get plots with a consistent layout. The convertion can be done within R. See the code below. system(C:/Progra~1/gs/gs8.64/bin/gswin32 -r300 -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -dGraphicsAlphaBits=4 -sOutputFile=fig_Power_Resid.png fig_Power_Resid.pdf) HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research Institute for Nature and Forest team Biometrics Quality Assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 thierry.onkel...@inbo.be www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -Oorspronkelijk bericht- Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens Nevil Amos Verzonden: vrijdag 30 april 2010 1:37 Aan: Greg Snow CC: r-help@r-project.org Onderwerp: Re: [R] reduce size of pdf The file is a large number of scatterplot matrices (120pp of 4x4 matrix) the individual plots may have up to several hudred points. I am already using the useDingbats but the files are still very large - I can reduce them about 50% in cute.pdf by changing the dpi setting but it would be good to handle directly in R They need to be screen/ draft print quality only not for publication. They are being used to ciruclate to a number of people for discussion On 30/04/2010 2:20 AM, Greg Snow wrote: 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? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Druk dit bericht a.u.b. niet onnodig af. Please do not print this message unnecessarily. Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document. The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Rotating Titles
Edit the strat.plot function, particularly the line text(tks1[1], pos, labels = colnames(d)[i], adj = c(0, 1), srt = 90, cex = cex.xlabel, xpd = NA) where the rotation is hardcoded or ask the maintainer to make it an argument to the function so that you can change it on calling the plot function. Uwe Ligges On 29.04.2010 20:08, Brendan Wiltse wrote: Hi All, I am looking for help in rotating species titles produced using the strat.plot( ) function in the rioja package. This function produces a stratigraphic plot of paleoenvironmental data. Currently the titles of each species are plotted vertically while they are typically plotted at a 45 degree angle in other programs. Does anyone have any idea of how to rotates these titles? Below is an example plot (taken from the rioja help file) made the function. Cheers, Brendan Wiltse library(vegan) ## decorana data(RLGH) library(rioja) ## Not run: # create appropriately sized graphics window windows(width=12, height=7) # quartz() on Mac, X11 on linux ## End(Not run) # remove less abundant taxa mx- apply(RLGH$spec, 2, max) spec- RLGH$spec[, mx 3] depth- RLGH$depth$Depth #basic stratigraphic plot strat.plot(spec, y.rev=TRUE) #scale for percentage data strat.plot(spec, y.rev=TRUE, scale.percent=TRUE) # plot by sample depth strat.plot(spec, yvar = depth, y.rev=TRUE, scale.percent=TRUE, title=Round Loch of Glenhead, ylabel=Depth (cm)) - Brendan Wiltse Ph.D. Candidate Paleoecological Environmental Assessment and Research Lab Department of Biology Queen's University http://www.wix.com/wiltse/Personal-Homepage http://wiltse.redbubble.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] read.csv and blank character in object name of my data.frame
TY so much, I ignored about this argument. Adding stripe.white=T as an argument in my read.csv does the job. -Original Message- From: Uwe Ligges [mailto:lig...@statistik.tu-dortmund.de] Sent: Friday, April 30, 2010 1:08 PM To: arnaud Gaboury Cc: r-help@r-project.org Subject: Re: [R] read.csv and blank character in object name of my data.frame See ?read.table and its argument strip.white. Uwe Ligges On 30.04.2010 09:39, arnaud Gaboury wrote: Dear group, Here is my data frame: position100415- structure(list(DESCRIPTION = structure(1:9, .Label = c( SUGAR NO.11 Jul/10 , SUGAR NO.11 May/10 , CORN May/10 , COTTON NO.2 Jul/10 , CRUDE OIL miNY May/10 , ROBUSTA COFFEE (10) Jul/10 , SILVER May/10 , SOYBEANS Jul/10 , WHEAT May/10 ), class = factor), POSITION = c(3, -1, 3, 4, 3, 10, 1, 1, 6), SETTLEMENT = c(17.08, 16.85, 363.25, 82.12, 85.51, 1386, 1843.3, 993, 480.25)), .Names = c(DESCRIPTION, POSITION, SETTLEMENT), row.names = c(NA, 9L), class = data.frame) As you can see, I have a blank at the end of each name of objects of list DESCRIPTION (e.g COTTON NO.2 Jul/10_,. I need to remove them. My data frame has been obtained from a .csv file and then a few command lines. Here is the first line of my code : pose=read.csv2(LSCPos100415.csv,sep=,,dec=.,as.is=T,h=T,skip=1)[, c(4,8 ,14,15)] As you can see, the blank already exists (e.g CORN May/10_), so it should come from the Excel file itself. pose- structure(list(DESCRIPTION = c(CORN May/10 , CORN May/10 , SOYBEANS Jul/10 , WHEAT May/10 , WHEAT May/10 , WHEAT May/10 , WHEAT May/10 , WHEAT May/10 , WHEAT May/10 , COTTON NO.2 Jul/10 , COTTON NO.2 Jul/10 , SUGAR NO.11 Jul/10 , SUGAR NO.11 Jul/10 , SUGAR NO.11 Jul/10 , SUGAR NO.11 May/10 , CRUDE OIL miNY May/10 , CRUDE OIL miNY May/10 , ROBUSTA COFFEE (10) Jul/10 , ROBUSTA COFFEE (10) Jul/10 , ROBUSTA COFFEE (10) Jul/10 , ROBUSTA COFFEE (10) Jul/10 , ROBUSTA COFFEE (10) Jul/10 , ROBUSTA COFFEE (10) Jul/10 , ROBUSTA COFFEE (10) Jul/10 , ROBUSTA COFFEE (10) Jul/10 , ROBUSTA COFFEE (10) Jul/10 , SILVER May/10 , PRM HGH GD ALUMINIUM USD 09/07/10 , PRM HGH GD ALUMINIUM USD 09/07/10 , PRIMARY NICKEL USD 04/06/10 , PRIMARY NICKEL USD 04/06/10 , PRIMARY NICKEL USD 10/06/10 , PRIMARY NICKEL USD 10/06/10 , STANDARD LEAD USD 01/07/10 , STANDARD LEAD USD 01/07/10 , STANDARD LEAD USD 01/07/10 , STANDARD LEAD USD 01/07/10 , STANDARD LEAD USD 01/07/10 , STANDARD LEAD USD 01/07/10 , STANDARD LEAD USD 01/07/10 , STANDARD LEAD USD 06/07/10 , STANDARD LEAD USD 19/04/10 , STANDARD LEAD USD 19/04/10 , STANDARD LEAD USD 22/06/10 , STANDARD LEAD USD 23/06/10 , STANDARD LEAD USD 23/06/10 , STANDARD LEAD USD 23/06/10 , STANDARD LEAD USD 25/06/10 , STANDARD LEAD USD 25/06/10 , STANDARD LEAD USD 29/06/10 , STANDARD LEAD USD 29/06/10 , SPCL HIGH GRADE ZINC USD 06/07/10 , SPCL HIGH GRADE ZINC USD 06/07/10 , SPCL HIGH GRADE ZINC USD 06/07/10 , SPCL HIGH GRADE ZINC USD 06/07/10 , SPCL HIGH GRADE ZINC USD 06/07/10 , SPCL HIGH GRADE ZINC USD 06/07/10 , SPCL HIGH GRADE ZINC USD 06/07/10 , SPCL HIGH GRADE ZINC USD 07/07/10 , SPCL HIGH GRADE ZINC USD 07/07/10 , SPCL HIGH GRADE ZINC USD 07/07/10 , SPCL HIGH GRADE ZINC USD 08/07/10 , SPCL HIGH GRADE ZINC USD 08/07/10 , SPCL HIGH GRADE ZINC USD 08/07/10 , SPCL HIGH GRADE ZINC USD 09/07/10 , SPCL HIGH GRADE ZINC USD 09/07/10 , SPCL HIGH GRADE ZINC USD 09/07/10 , SPCL HIGH GRADE ZINC USD 09/07/10 , SPCL HIGH GRADE ZINC USD 09/07/10 , SPCL HIGH GRADE ZINC USD 13/07/10 , SPCL HIGH GRADE ZINC USD 13/07/10 , SPCL HIGH GRADE ZINC USD 14/07/10 , SPCL HIGH GRADE ZINC USD 14/07/10 , SPCL HIGH GRADE ZINC USD 14/07/10 , SPCL HIGH GRADE ZINC USD 14/07/10 , SPCL HIGH GRADE ZINC USD 15/07/10 , SPCL HIGH GRADE ZINC USD 15/07/10 , SPCL HIGH GRADE ZINC USD 15/07/10 , SPCL HIGH GRADE ZINC USD 15/07/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 17/05/10 , SPCL HIGH GRADE ZINC USD 18/05/10 , SPCL HIGH GRADE ZINC USD 18/05/10 , SPCL HIGH GRADE ZINC USD 18/05/10 , SPCL HIGH GRADE ZINC USD 18/05/10 , SPCL HIGH GRADE ZINC USD 18/05/10 , SPCL HIGH GRADE ZINC USD 19/04/10 , SPCL HIGH GRADE ZINC USD 19/04/10 , SPCL HIGH GRADE ZINC USD 19/04/10 , SPCL HIGH GRADE ZINC USD 19/04/10 , SPCL HIGH GRADE ZINC USD 19/05/10 , SPCL HIGH GRADE ZINC USD 20/04/10 , SPCL HIGH GRADE ZINC USD 20/04/10 , SPCL HIGH GRADE ZINC USD 21/04/10 , SPCL
[R] Problem: packages TinnR, Hmisc, applications Tinn-R and R version 2.11.0
Hi, First: sorry for my bad English! I have received several emails reporting problems using Tinn-R with the new R version (2.11.0). This email is meant to assist the users. This problem is new and is related with R 2.11.0 and Hmisc package for Windows! After download and install R 2.11.0pat under Linux and Windows, see below my results: a) Under Linux (Open SUSE 11.3) - I found no problem installing, compiling and using these packages: TinnR, Hmisc, R2HTML and svSocket. b) Under Windows (Vista Ultimate) - after to set the file Rprofile.site with the script (generated by Tinn-R, i.e, main menu R/Configure/Permanent (Rprofile.site), see below: ##=== ## Tinn-R: necessary packages and functions ## Tinn-R: = 2.2.0.2 with TinnR package = 1.0.3 ##=== ## Set the URL of the preferred repository, below some examples: options(repos='http://software.rc.fas.harvard.edu/mirrors/R/') # USA #options(repos='http://cran.ma.imperial.ac.uk/') # UK #options(repos='http://brieger.esalq.usp.br/CRAN/') # Brazil library(utils) ## Check necessary packages necessary - c('TinnR', 'svSocket') installed - necessary %in% installed.packages()[, 'Package'] if (length(necessary[!installed]) =1) install.packages(necessary[!installed]) ## Load packages library(TinnR) library(svSocket) ## Uncoment the two lines below if you want Tinn-R to always start R at start-up ## (Observation: check the path of Tinn-R.exe) #options(IDE='C:/Tinn-R/bin/Tinn-R.exe') #trStartIDE() ## Set options options(use.DDE=T) ## Start DDE trDDEInstall() .trPaths - paste(paste(Sys.getenv('APPDATA'), '\\Tinn-R\\tmp\\', sep=''), c('', 'search.txt', 'objects.txt', 'file.r', 'selection.r', 'block.r', 'lines.r'), sep='') #=== when R was rebooted I received the messages below: IO: #=== R version 2.11.0 Patched (2010-04-26 r51822) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. #=== Log: #=== Warning: dependency 'Hmisc' is not available also installing the dependencies 'R2HTML', 'svMisc' trying URL 'http://software.rc.fas.harvard.edu/mirrors/R/bin/windows/contrib/2.11/R2HTML_2.0.0.zip' length 464688 bytes (453 Kb) opened URL downloaded 453 Kb trying URL 'http://software.rc.fas.harvard.edu/mirrors/R/bin/windows/contrib/2.11/svMisc_0.9-57.zip' length 134502 bytes (131 Kb) opened URL downloaded 131 Kb trying URL 'http://software.rc.fas.harvard.edu/mirrors/R/bin/windows/contrib/2.11/TinnR_1.0.3.zip' length 37715 bytes (36 Kb) opened URL downloaded 36 Kb trying URL 'http://software.rc.fas.harvard.edu/mirrors/R/bin/windows/contrib/2.11/svSocket_0.9-48.zip' length 59065 bytes (57 Kb) opened URL downloaded 57 Kb Loading required package: tcltk done Loading required package: Hmisc Error: package 'Hmisc' could not be loaded In addition: Warning message: In library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc) : there is no package called 'Hmisc' #=== So, the main problem is related with the package 'Hmisc' under Windows! I closed the R. I did a copy/paste from my previous Hmisc package ('library' of my old R version: R-2.10.0pat) to the folder 'library' of my new R version: R-2.11.0pat. So, I rebooted R newly and below the results: IO: #=== R version 2.11.0 Patched (2010-04-26 r51822) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. ' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. #=== Log: #=== Type 'contributors()Loading required package: mvbutils Loading required package: utils
Re: [R] control span in panel.loess in xyplot
something like xyplot(y ~ x, data = d, groups = z, panel = panel.superpose, panel.groups = function(..., group.number) { panel.xyplot(...) span - switch(group.number, 2/3, 1/4, 1/2) panel.loess(..., span = span) }, auto.key = list(lines = TRUE)) On Friday, April 30, 2010, Santosh santosh2...@gmail.com wrote: I could not make group.number work either..how do I get that? ...panel.superpose(panel.groups=group.number(),panel.bwplot,...) ? On Thu, Apr 29, 2010 at 4:26 PM, Felix Andrews fe...@nfrac.org wrote: Within panel.superpose, the current group number is passed as group.number to the panel.groups function. On 29 April 2010 20:39, Gabor Grothendieck ggrothendi...@gmail.com wrote: 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 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)) xyplot(y~x,data=d,groups=z,panel=panel.superpose,panel.groups=panel.loess(span=c(2/3, 3/4,1/2)) or something like.. xyplot(y~x,data=d,groups=z,panel=function(...) {panel.superpose(...);panel.groups=panel.loess(span=3/4,...)}) Thanks, Santosh [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Felix Andrews / 安福立 Postdoctoral Fellow Integrated Catchment Assessment and Management (iCAM) Centre Fenner School of Environment and Society [Bldg 48a] The Australian National University Canberra ACT 0200 Australia M: +61 410 400 963 T: + 61 2 6125 4670 E: felix.andr...@anu.edu.au CRICOS Provider No. 00120C -- http://www.neurofractal.org/felix/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Curve Fitting/Regression with Multiple Observations
You may want to run RSiteSearch(monotone splines) at the R prompt. The 3rd hit looks quite promising. However, if I understand your data, you have multiple y values for the same x values. If so, can you justify inverting the regression function? The traffic on this mailing list is very high, and the signal to noise ratio is rather low. This has the tendency of burning out those who started with good intentions to help. Andy From: Kyeong Soo (Joseph) Kim Dear Keith, Thanks for the suggestion and taking your time to respond to it. But, you misunderstand something and seems that you do not read all my previous e-mails. For instance, can a hand-drawing curve give you an inverse function (analytically or numerically) so that you can find an x value given the y value (not just for one, but for hundreds of points)? As for the statistical inferences, I admit that my communications were not that very clear. My intention is to get a smoothed curve from the simulation data in a statistically meaningful way as much as possible for my intended use of the resulting curve. As said before, I don't know all the thorough theoretical details behind regression and curve fitting functions available in R (know the basics though as one with PhD in Elec. Eng. unlike someone's assessment), but am doing my best to catch up reading textbooks and manuals, and posting this question to this list is definitely a way to learn from many experts and advanced users of R. By the way, I wonder why most of the responses I've received from this list are so cynical (or skeptical?) and in some sense done in a quite arrogant way. It's very hard to imagine that one would receive such responses in my own areas of computer simulation and optical communications/networking. If a newbie asks a question to the list not making much sense or another FAQ, that is usually ignored (i.e., no response) because all we are too busy to deal with that. Sometimes, though, a kind soul (like Gabor) takes his/her own valuable time and doesn't mind explaining all the details from simple basics. Again, what I want to hear from the list is the proper use of regression/curve fitting functions of R for my simulation data with replications: Applying after taking means or directly on them? So far I haven't heard anyone even specifically touching my question, although there were several seemingly related suggestions. Regards, Joseph On Fri, Apr 30, 2010 at 4:25 AM, kMan kchambe...@gmail.com wrote: Dear Joseph, If you do not need to make any inferences, that is, you just want it to look pretty, then drawing a curve by hand is as good a solution as any. Plus, there is no reason for expert testimony to say that the curve does not mean anything. Sincerely, KeithC. -Original Message- From: Kyeong Soo (Joseph) Kim [mailto:kyeongsoo@gmail.com] Sent: Tuesday, April 27, 2010 2:33 PM To: Gabor Grothendieck Cc: r-help@r-project.org Subject: Re: [R] Curve Fitting/Regression with Multiple Observations Frankly speaking, I am not looking for such a framework. The system I'm studying is a communication network (like M/M/1 queue, but way too complicated to mathematically analyze it using classical queueing theory) and the conclusion I want to make is qualitative rather than quantatitive -- a high-level comparative study of various network architectures based on the equivalence principle (a concept specific to netwokring, not in the general sense). What l want in this regard is a smooth, non-decreasing (hence one-to-one) function built out of simulation data because later in my processing, I need an inverse function of the said curve to find out an x value given the y value. That was, in fact, the reason I used the exponential (i.e., non-decreasing function) curve fiting. Even though I don't need a statistical inference framework for my work, I want to make sure that my use of regression/curve fitting techniques with my simulation data (as a tool for getting the mentioned curve) is proper and a usual practice among experts like you. To get answer to my question, I digged a lot through the Internet but found no clear explanation so far. Your suggestions and providing examples (always!) are much appreciated, but I am still not sure the use of those regression procedures with the kind of data I described is a right way to do. Again, many thanks for your prompt and kind answers, Joseph On Tue, Apr 27, 2010 at 8:46 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: If you are looking for a framework for statistical inference you could look at additive models as in the mgcv package which has a book associated with it if you need more info. e.g. library(mgcv) fm - gam(dist ~ s(speed), data = cars) summary(fm) plot(dist ~ speed, cars, pch = 20) fm.ci - with(predict(fm, se = TRUE), cbind(0,
Re: [R] apply fun to df returning a matrix
Hi Mohamed, thanks for your answer. Anyway, the how to is exactly my problem, since ... fun2 - function(x){ please_use_aggregate_and_apply_in_some_way_and_return_the_output_of_my_example_as_requested (fun(x)); } fun2(df); ... unfortunately returns an error ;-). Could you please give a simple example? Thanks, Sören On 30.04.2010, at 12:59, Mohamed Lajnef wrote: Hi Soeren Apply or aggregate functions best regards M soeren.vo...@eawag.ch a écrit : Hello, a data.frame, df, holds the numerics, x, y, and z. A function, fun, should return some arbitrary statistics about the arguments, e.g. the sum or anything else. What I want to do is to apply this function to every pair of variables in df, and the return should be a matrix as found with cov. How can I achieve that? Thanks, Sören df - data.frame(x=1:10, y=11:20, z=21:30); fun - function(x){ return(sum(x)); } # and now??? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] apply fun to df returning a matrix
On 30/04/2010 7:55 AM, soeren.vo...@eawag.ch wrote: Hi Mohamed, thanks for your answer. Anyway, the how to is exactly my problem, since ... fun2 - function(x){ please_use_aggregate_and_apply_in_some_way_and_return_the_output_of_my_example_as_requested (fun(x)); } fun2(df); ... unfortunately returns an error ;-). Could you please give a simple example? Thanks, Sören I would have recommended a nested for loop, but here it is with apply: df - data.frame(a=1:10, b=11:20, c=21:30) f - function(x,y) sum(x*y) apply(df, 2, function(x) apply(df, 2, function(y) f(x,y))) abc a 385 935 1485 b 935 2485 4035 c 1485 4035 6585 To me this looks clearer: result - matrix(NA, 3,3) for (i in 1:3) for (j in 1:3) result[i,j] - f(df[,i], df[,j]) Duncan Murdoch On 30.04.2010, at 12:59, Mohamed Lajnef wrote: Hi Soeren Apply or aggregate functions best regards M soeren.vo...@eawag.ch a écrit : Hello, a data.frame, df, holds the numerics, x, y, and z. A function, fun, should return some arbitrary statistics about the arguments, e.g. the sum or anything else. What I want to do is to apply this function to every pair of variables in df, and the return should be a matrix as found with cov. How can I achieve that? Thanks, Sören df - data.frame(x=1:10, y=11:20, z=21:30); fun - function(x){ return(sum(x)); } # and now??? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] apply fun to df returning a matrix
On Apr 30, 2010, at 6:59 AM, Mohamed Lajnef wrote: Hi Soeren Apply or aggregate functions Probably needs combn as well. Could do it all with numeric indices, but this effort with character vectors seems acceptable: fun - function(x){ cnms - colnames(x) return(apply(combn(cnms,2), 2, function(y) sum(x[,y]))) } fun(df) #[1] 210 310 410 I do have a question about returning a matrix though. Did you mena that you wanted the pairs of sums rather than the sums of pairs. In that case: fun2 - function(x){cnms - colnames(x) return(apply(combn(cnms,2), c(1,2), function(y) sum(x[,y]))) } fun2(df) # [,1] [,2] [,3] #[1,] 55 55 155 #[2,] 155 255 255 -- David. best regards M soeren.vo...@eawag.ch a écrit : Hello, a data.frame, df, holds the numerics, x, y, and z. A function, fun, should return some arbitrary statistics about the arguments, e.g. the sum or anything else. What I want to do is to apply this function to every pair of variables in df, and the return should be a matrix as found with cov. How can I achieve that? Thanks, Sören df - data.frame(x=1:10, y=11:20, z=21:30); fun - function(x){ return(sum(x)); } # and now??? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Mohamed Lajnef,IE INSERM U955 eq 15 Pôle de Psychiatrie Hôpital CHENEVIER 40, rue Mesly 94010 CRETEIL Cedex FRANCE mohamed.laj...@inserm.fr tel : 01 49 81 31 31 (poste 18470) Sec : 01 49 81 32 90 fax : 01 49 81 30 99 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] RBloomberg for 2.11 ?
Dear R Users, Is there a version of the Windows binary for RBloomberg that works with R 2.11 ? Thanks in advance, Tolga This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] colouring locfit bands
Hi there. If I plot simultaneous confidence bands: plot(locfitObject.lf, band='l', col=4) While I can colour the locfit plot line (as above), the confidence bands always come out black. Can anyone tell me how to colour the confidence bands - at least, to the same colour that I specify for the locally-fitted estimate line? Stuart Dr Stuart J Leask DM FRCPsych MA BChir Clinical Senior Lecturer and Honorary Consultant in Clinical Psychiatry University Dept of Psychiatry, A Floor, Queen's Medical Centre, Nottingham. NG7 2UH www: Google Dr Stuart Leask This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] apply fun to df returning a matrix
Thanks for the code, that was exactly what I was looking for. Regards, Sören On 30.04.2010, at 14:04, David Winsemius wrote: On Apr 30, 2010, at 6:59 AM, Mohamed Lajnef wrote: Hi Soeren Apply or aggregate functions Probably needs combn as well. Could do it all with numeric indices, but this effort with character vectors seems acceptable: fun - function(x){ cnms - colnames(x) return(apply(combn(cnms,2), 2, function(y) sum(x[,y]))) } fun(df) #[1] 210 310 410 I do have a question about returning a matrix though. Did you mena that you wanted the pairs of sums rather than the sums of pairs. In that case: fun2 - function(x){cnms - colnames(x) return(apply(combn(cnms,2), c(1,2), function(y) sum(x[,y]))) } fun2(df) # [,1] [,2] [,3] #[1,] 55 55 155 #[2,] 155 255 255 -- David. best regards M soeren.vo...@eawag.ch a écrit : Hello, a data.frame, df, holds the numerics, x, y, and z. A function, fun, should return some arbitrary statistics about the arguments, e.g. the sum or anything else. What I want to do is to apply this function to every pair of variables in df, and the return should be a matrix as found with cov. How can I achieve that? Thanks, Sören df - data.frame(x=1:10, y=11:20, z=21:30); fun - function(x){ return(sum(x)); } # and now??? -- Mohamed Lajnef,IE INSERM U955 eq 15 Pôle de Psychiatrie Hôpital CHENEVIER 40, rue Mesly 94010 CRETEIL Cedex FRANCE mohamed.laj...@inserm.fr tel : 01 49 81 31 31 (poste 18470) Sec : 01 49 81 32 90 fax : 01 49 81 30 99 David Winsemius, MD West Hartford, CT -- Sören Vogel, Dipl.-Psych. (Univ.), PhD-Student, Eawag, Dept. SIAM http://www.eawag.ch, http://sozmod.eawag.ch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] RBloomberg for 2.11 ?
On Fri, 30 Apr 2010, Tolga I Uzuner wrote: Dear R Users, Is there a version of the Windows binary for RBloomberg that works with R 2.11 ? Yes, on my machine. But what is stopping you building one as the @ReadMe and rw-FAQ asked you to? It is a pure R package and install.packages(type=source') will be able to install it without any additional tools. You will first need to install RDCOMClient, but that is available from Omegahat. So setRepositories(ind=1:3) install.packages(c('RDCOMClient', 'zoo', 'chron')) install.packages('RBloomberg', type='source') or something similar should install it for you. (Please do follow the posting guide. I am guessing you meant *32-bit* Windows, but you do really need to tell us the information we asked for.) Thanks in advance, Tolga This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] y-axis log scale in library lattice
Hello all, Is there an argument in function xyplot (library lattice) equivalent to log=y in base graphics? I mean transforming the axis, not the variable, as the help on argument log inscales says Note that this is a transformation of the data, not the axes. Thanks in advance, Duarte Viana __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] short question about data frame manipulation
Dear group, I am losing my mind with a simple question. Sorry if obvious, but I maybe start to be confused after days and days of reading documentations. Df : df - structure(list(a = 1:3, b = 4:6, c = structure(c(1L, 1L, 1L), class = factor, .Label = w)), .Names = c(a, b, c), row.names = c(NA, -3L), class = data.frame) I want to multiply first and second by -1. x$a-x$a*-1 x$b-x$b*-1 This returns what I want, but there must be an one line command to do it, right? TY for help __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] short question about data frame manipulation
On Apr 30, 2010, at 9:08 AM, arnaud Gaboury wrote: Dear group, I am losing my mind with a simple question. Sorry if obvious, but I maybe start to be confused after days and days of reading documentations. Df : df - structure(list(a = 1:3, b = 4:6, c = structure(c(1L, 1L, 1L), class = factor, .Label = w)), .Names = c(a, b, c), row.names = c(NA, -3L), class = data.frame) I want to multiply first and second by -1. x$a-x$a*-1 x$b-x$b*-1 This returns what I want, but there must be an one line command to do it, right? df[ , -3] - df[ , -3]*-1 df a b c 1 -1 -4 w 2 -2 -5 w 3 -3 -6 w -- David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Dynamische Programmierung mit R
Weiss ich nicht genau ob es in R gibt, aber versuch mal Processing.org - Lanna Jin lanna...@gmail.com 510-898-8525 -- View this message in context: http://r.789695.n4.nabble.com/Dynamische-Programmierung-mit-R-tp2076695p2076909.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] GSL in C code for R
Hello, I'm following this, since it seems I'm having to try to get C code going in order to estimate dynamic models from biological data.Without saying that gsl and related packages are proving to be obdurate, and knowing that R is proving to be an excellent solution to the widest range of statistical problems, is there a way to estimate dynamic/ode models from biological data that uses R? regards, Alexander(I add that my attempts with James W. Haefner's c programming course from Modeling Biological Systems is the precursor here.) On Sat, Apr 17, 2010 at 3:56 AM, Prof Brian Ripley rip...@stats.ox.ac.ukwrote: On Fri, 16 Apr 2010, Charles C. Berry wrote: On Fri, 16 Apr 2010, J. Sebastian Tello wrote: Dear fellow R users, I am now investing time in learning how to use compiled C code to produces functions that can be used in R. I am just starting, and there is much that I need to learn, so I have a question that might be straight forward. I am See the posting guide: this is not the list advised for non-R programming questions. learning how to use function in the C library GSL (gnu scientific library), to write C code, that I then plant to use in R. Is there any problem in doing this? I mean, using functions of GSL to write C funtions to then use them in R? I just want to make sure that this approach is correct, before I invest more time trying to figure out how to include GSL functions into my C functions. Any commentaries, insights or advice will be highly appreciated. per the posting guide (Do Your Homework section), you should do this: RSiteSearch(GSL) If you are considering doing something that might be submitted to BioConductor, you should read up on what they require: http://wiki.fhcrc.org/bioc/Package_Guidelines IIRC, they tend to discourage the use of external libraries. Maybe they do, but at least one package, GLAD, requires gsl in a rather non-standard way and several others have really arcane requirements for external libraries, some of which will not install on any of my systems. There are I believe 3 CRAN packages (gsl, BayesPanel, segclust) make use of gsl. The R API is rich with functions that provide a lot of what GSL has, so you might want to study that before committing to GSL. I agree: people who use gsl to do things R already does have caused problems in the past. If you want to distribute your package you should be aware that gsl is not written with any concessions to portability. It is a real pain to port to Windows (but I have managed with some versions and 32- and 64-bit builds as used for CRAN are at http://www.stats.ox.ac.uk/pub/Rtools/). HTH, Chuck Sebastian J. Sebasti?n Tello Department of Biological Sciences 285 Life Sciences Building Louisiana State University Baton Rouge, LA, 70803 (225) 578-4284 (office and lab.) [[alternative HTML version deleted]] Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:cbe...@tajo.ucsd.edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R Windows64+RCommander
Hello Until now, I always used R for Winwows 32bits without any problem I just installed R for Windows 64bits. When I want to get Rcmdr package, an error occurs : package Hmisc is needed and it is not found When I go on the website of R-cran, I don't find Hmisc for R/Windows 64 bits Sincerely yours Andre LEBERT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Find solution for an error in the condition of if
warnings() 1: In if ((data[pa, k] == df[, j]) (data[ch, k] == i)) { ... : the condition has length1 ,and only the first element is used I add between the two conditions..it solve the problem. But , it gives a false result. Best Regards [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] short question about data frame manipulation
df[1:2]-df[1:2]*-1 - Lanna Jin lanna...@gmail.com 510-898-8525 -- View this message in context: http://r.789695.n4.nabble.com/short-question-about-data-frame-manipulation-tp2076891p2076899.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] reduce size of pdf
or possibly use smoothScatter() to produce the scatter plots On Fri, Apr 30, 2010 at 12:06 PM, ONKELINX, Thierry thierry.onkel...@inbo.be wrote: Dear Nevil, Converting your pdf to png will be the most efficient way to reduce the file size with scatter plots. You can either export directly to pdf or first create a pdf and then use ghostscript to convert it into png. I tend to the the latter because it is easier to get plots with a consistent layout. The convertion can be done within R. See the code below. system(C:/Progra~1/gs/gs8.64/bin/gswin32 -r300 -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -dGraphicsAlphaBits=4 -sOutputFile=fig_Power_Resid.png fig_Power_Resid.pdf) HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research Institute for Nature and Forest team Biometrics Quality Assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 thierry.onkel...@inbo.be www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -Oorspronkelijk bericht- Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens Nevil Amos Verzonden: vrijdag 30 april 2010 1:37 Aan: Greg Snow CC: r-help@r-project.org Onderwerp: Re: [R] reduce size of pdf The file is a large number of scatterplot matrices (120pp of 4x4 matrix) the individual plots may have up to several hudred points. I am already using the useDingbats but the files are still very large - I can reduce them about 50% in cute.pdf by changing the dpi setting but it would be good to handle directly in R They need to be screen/ draft print quality only not for publication. They are being used to ciruclate to a number of people for discussion On 30/04/2010 2:20 AM, Greg Snow wrote: 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? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Druk dit bericht a.u.b. niet onnodig af. Please do not print this message unnecessarily. Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document. The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R Windows64+RCommander
Am 30.04.2010 12:26, schrieb Andre Lebert: Hello Until now, I always used R for Winwows 32bits without any problem I just installed R for Windows 64bits. When I want to get Rcmdr package, an error occurs : package Hmisc is needed and it is not found When I go on the website of R-cran, I don't find Hmisc for R/Windows 64 bits It does not pass the checks under any R-2.11.0 (hence not at all a 32 vs. 64 bit issue, not even a Windows one). As discussed before on this list, my forecast id you will see a new version on CRAN next week. Best, Uwe Ligges Sincerely yours Andre LEBERT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R Windows64+RCommander
This morning: https://stat.ethz.ch/pipermail/r-help/2010-April/237216.html On Apr 30, 2010, at 6:26 AM, Andre Lebert wrote: Hello Until now, I always used R for Winwows 32bits without any problem I just installed R for Windows 64bits. When I want to get Rcmdr package, an error occurs : package Hmisc is needed and it is not found When I go on the website of R-cran, I don't find Hmisc for R/Windows 64 bits Sincerely yours -- David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] any feedback on XL Solutions Courses for R?
I took a course and was pleased with the quality. The experience may depend significantly on the instructor. Kevin On Fri, Apr 30, 2010 at 2:22 AM, Liviu Andronic landronim...@gmail.comwrote: On 4/30/10, Dimitri Liakhovitski ld7...@gmail.com wrote: I can only provide feedback on one and only course I participated in. It was 3 years ago. It was for R beginners. And I guess, we did not get lucky - the person who was sent was not a good instructor. Our boss at the company I was working for at the time (who is very good with R) ended up answering all our questions while the instructor looked helpless. Of course, it's possible that they anticipated more advanced audience - but still it was not good. Bear in mind - it's a sample size of ONE. (I never took their classes.) To make it two, I was never impressed by their site and announcements. It all seemed so unprofessional. Bit of off-topic, but I like fortune(xl). Liviu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Kevin Wright [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] plotting multiple CIs
Hello, I need to plot multiple confidence intervals for the same model parameter e.g. so for the same value of the parameter in point x_1 I would like to see four different confidence intervals so that I can compare the accuracy e.g. boot basic vs normal vs my own vs classic lm CI etc. I like very very much the plotCI implemented here: http://cran.r-project.org/web/packages/plotrix/index.html This is their example: library(plotrix) y - runif(10) err - runif(10) plotCI(x=1:10,y=y,uiw=err,liw=2*err,lwd=2,col=red,scol=blue,main=Add colors to the points and error bars) but does not seem to support plotting multiple CIs but only one per point, is there a similar library somewhere but having the possibility to plot multiple CIs? I know there is the function segment but I like this one above more :) Thanks in advance, Best regards, Giovanni __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] extracting pairs from correlation matrix and p-value matrix
Dear All, I am working on a large matrix of dimension 2x700 say 'mat'. I have calculated pearson correlation for the rows of the matrix and their p-values using rcorr function in library Hmisc. Now I wish to filter out those pairs who's PCC value is above 0.8 cut off and p-value is less than 0.05. library(Hmisc) mat_cor=rcorr(t(mat),type=pearson) head(mat_cor) aaeA_b3241_14 aaeB_b3240_15 aaeR_b3243_15 aaeX_b3242_12 aas_b2836_14 aat_b0885_14 abgA_b1338_14 abgB_b1337_15 abgR_b1339_15 abgT_b1336_15 aaeA_b3241_14 1.00 0.12 0.64 0.21 0.10-0.68 -0.61 -0.62 -0.66 -0.67 aaeB_b3240_15 0.12 1.00 -0.57 0.26 -0.50 0.05 0.50 0.46 0.40 0.47 aaeR_b3243_15 0.64 -0.57 1.00 -0.02 0.45-0.52 -0.93 -0.92 -0.91 -0.96 aaeX_b3242_12 0.21 0.26 -0.02 1.00 -0.45-0.60 -0.20 -0.16 -0.22 -0.07 aas_b2836_14 0.10 -0.50 0.45 -0.45 1.00-0.08 -0.53 -0.57 -0.52 -0.58 aat_b0885_14 -0.68 0.05 -0.52 -0.60 -0.08 1.00 0.63 0.61 0.64 0.59 abgA_b1338_14 -0.61 0.50 -0.93 -0.20 -0.53 0.63 1.00 0.99 0.99 0.98 abgB_b1337_15 -0.62 0.46 -0.92 -0.16 -0.57 0.61 0.99 1.00 1.00 0.99 abgR_b1339_15 -0.66 0.40 -0.91 -0.22 -0.52 0.64 0.99 1.00 1.00 0.98 abgT_b1336_15 -0.67 0.47 -0.96 -0.07 -0.58 0.59 0.98 0.99 0.98 1.00 n= 2 P aaeA_b3241_14 aaeB_b3240_15 aaeR_b3243_15 aaeX_b3242_12 aas_b2836_14 aat_b0885_14 abgA_b1338_14 abgB_b1337_15 abgR_b1339_15 abgT_b1336_15 aaeA_b3241_14 0.74010.04570.5556 0.7774 0.0289 0.06290.05610.0371 0.0351 aaeB_b3240_15 0.7401 0.08680.4644 0.1435 0.8840 0.13750.17990.2522 0.1747 aaeR_b3243_15 0.04570.0868 0.9529 0.1915 0.1198 0.0.00010.0002 0. aaeX_b3242_12 0.55560.46440.9529 0.1905 0.0670 0.58130.66100.5441 0.8422 aas_b2836_14 0.77740.14350.19150.1905 0.8295 0.11670.08510.1224 0.0784 aat_b0885_14 0.02890.88400.11980.0670 0.82950.05210.06260.0449 0.0740 abgA_b1338_14 0.06290.13750.0.5813 0.1167 0.0521 0.0. 0. abgB_b1337_15 0.05610.17990.00010.6610 0.0851 0.0626 0. 0. 0. abgR_b1339_15 0.03710.25220.00020.5441 0.1224 0.0449 0.0. 0. abgT_b1336_15 0.03510.17470.0.8422 0.0784 0.0740 0.0.0. Now from mat_cor$r and mat_cor$P I wish to extract those pairs which satisfies the condition PCC0.8 and p-value0.05. But I am puzzled!! Please help. regards Amit __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Something similar to loess for 2D curves?
Carlos J. Gil Bellosta cgb at datanalytics.com writes: Hello, I have been struggling to find something similar to loess for 2D curves. I have a number of 2D curves t --- (x(t), y(t)) with some noise that I want to filter out. There may also be some (very few) obvious outliers in the data. thin-plate or tensor product splines in package mgcv? Ben Bolker __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Rcpp static variables
Guys, I was wondering whether anyone experimented with Rcpp and static variables. I remember reading that Rcpp is essentially stateless. That makes sense. However I just run a piece of code that contains a static STL structure, surprisingly it seems that those static variables are preserved... The question is, can we use static variable to reliably preserve state between Rcpp calls? Cheers, //Giuseppe MAKO This email and any files transmitted with it are confide...{{dropped:17}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem: packages TinnR, Hmisc, applications Tinn-R and R version 2.11.0
... but please note that the old Hmisc version does not pass the checks under R-2.11.0. This has been discussed several times on the lists both yesterday and today. Best wishes, Uwe Ligges Am 30.04.2010 13:20, schrieb Jose Claudio Faria: Hi, First: sorry for my bad English! I have received several emails reporting problems using Tinn-R with the new R version (2.11.0). This email is meant to assist the users. This problem is new and is related with R 2.11.0 and Hmisc package for Windows! After download and install R 2.11.0pat under Linux and Windows, see below my results: a) Under Linux (Open SUSE 11.3) - I found no problem installing, compiling and using these packages: TinnR, Hmisc, R2HTML and svSocket. b) Under Windows (Vista Ultimate) - after to set the file Rprofile.site with the script (generated by Tinn-R, i.e, main menu R/Configure/Permanent (Rprofile.site), see below: ##=== ## Tinn-R: necessary packages and functions ## Tinn-R:= 2.2.0.2 with TinnR package= 1.0.3 ##=== ## Set the URL of the preferred repository, below some examples: options(repos='http://software.rc.fas.harvard.edu/mirrors/R/') # USA #options(repos='http://cran.ma.imperial.ac.uk/') # UK #options(repos='http://brieger.esalq.usp.br/CRAN/') # Brazil library(utils) ## Check necessary packages necessary- c('TinnR', 'svSocket') installed- necessary %in% installed.packages()[, 'Package'] if (length(necessary[!installed])=1) install.packages(necessary[!installed]) ## Load packages library(TinnR) library(svSocket) ## Uncoment the two lines below if you want Tinn-R to always start R at start-up ## (Observation: check the path of Tinn-R.exe) #options(IDE='C:/Tinn-R/bin/Tinn-R.exe') #trStartIDE() ## Set options options(use.DDE=T) ## Start DDE trDDEInstall() .trPaths- paste(paste(Sys.getenv('APPDATA'), '\\Tinn-R\\tmp\\', sep=''), c('', 'search.txt', 'objects.txt', 'file.r', 'selection.r', 'block.r', 'lines.r'), sep='') #=== when R was rebooted I received the messages below: IO: #=== R version 2.11.0 Patched (2010-04-26 r51822) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. #=== Log: #=== Warning: dependency 'Hmisc' is not available also installing the dependencies 'R2HTML', 'svMisc' trying URL 'http://software.rc.fas.harvard.edu/mirrors/R/bin/windows/contrib/2.11/R2HTML_2.0.0.zip' length 464688 bytes (453 Kb) opened URL downloaded 453 Kb trying URL 'http://software.rc.fas.harvard.edu/mirrors/R/bin/windows/contrib/2.11/svMisc_0.9-57.zip' length 134502 bytes (131 Kb) opened URL downloaded 131 Kb trying URL 'http://software.rc.fas.harvard.edu/mirrors/R/bin/windows/contrib/2.11/TinnR_1.0.3.zip' length 37715 bytes (36 Kb) opened URL downloaded 36 Kb trying URL 'http://software.rc.fas.harvard.edu/mirrors/R/bin/windows/contrib/2.11/svSocket_0.9-48.zip' length 59065 bytes (57 Kb) opened URL downloaded 57 Kb Loading required package: tcltk done Loading required package: Hmisc Error: package 'Hmisc' could not be loaded In addition: Warning message: In library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc) : there is no package called 'Hmisc' #=== So, the main problem is related with the package 'Hmisc' under Windows! I closed the R. I did a copy/paste from my previous Hmisc package ('library' of my old R version: R-2.10.0pat) to the folder 'library' of my new R version: R-2.11.0pat. So, I rebooted R newly and below the results: IO: #=== R version 2.11.0 Patched (2010-04-26 r51822) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. ' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help.
Re: [R] competing risk analysis
The object `xx' is a list with 3 components time, est, and var. You need the `est' component of this list. So, you simply do the following: bbb - xx$est There is no function called `cuminc.est' in the cmprsk package. Hope this helps, Ravi. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of paaventhan jeyaganth Sent: Thursday, April 29, 2010 3:42 PM Cc: r Subject: [R] competing risk analysis Deart All, I am doing competing risk analysis, I am tring store the estimate value in bbb but it gives error, it's anybody knows how to store in estimated value. Thanks Paaveen xx - cuminc(wkdt$fu.year, wkdt$status) bbb - cuminc.est(xx,F) Error in cuminc.est: Argument number 2 not matched: cuminc.est(xx, F) cuminc.est(xx) [1] Competing-OtrMrt: 38/171 patients estimated lower(95%) upper(95%) 0 0.00 0.00 0.00 1 5.65 2.05 9.25 2 6.39 2.53 10.25 3 7.23 3.07 11.39 4 12.04 6.32 17.75 5 18.53 11.23 25.83 6 22.39 14.21 30.58 7 26.87 17.69 36.05 8 33.08 22.27 43.89 9 41.92 29.47 54.38 10 41.92 29.47 54.38 11 41.92 29.47 54.38 12 45.61 31.90 59.31 13 49.58 34.70 64.45 [1] Competing-CssMrt: 3/171 patients estimated lower(95%) upper(95%) 0 0.00 0.00 0.00 1 0.00 0.00 0.00 2 1.48 -0.56 3.53 3 1.48 -0.56 3.53 4 1.48 -0.56 3.53 5 1.48 -0.56 3.53 6 2.80 -0.48 6.07 7 2.80 -0.48 6.07 8 2.80 -0.48 6.07 9 2.80 -0.48 6.07 10 2.80 -0.48 6.07 11 2.80 -0.48 6.07 12 2.80 -0.48 6.07 13 2.80 -0.48 6.07 _ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plotting multiple CIs
Hi Giovanni, I think the ggplot2 package might help you out here. Do you want something like this? library(ggplot2) data(mtcars) p - ggplot(mtcars, aes(x=cyl, y=mpg)) p + stat_summary(fun.data = mean_cl_boot, colour = red, geom = errorbar) + stat_summary(fun.data = mean_cl_normal, colour = blue, geom = errorbar) ? See http://had.co.nz/ggplot2/stat_summary.html for details. -Ista On Fri, Apr 30, 2010 at 3:10 PM, Giovanni Azua brave...@gmail.com wrote: Hello, I need to plot multiple confidence intervals for the same model parameter e.g. so for the same value of the parameter in point x_1 I would like to see four different confidence intervals so that I can compare the accuracy e.g. boot basic vs normal vs my own vs classic lm CI etc. I like very very much the plotCI implemented here: http://cran.r-project.org/web/packages/plotrix/index.html This is their example: library(plotrix) y - runif(10) err - runif(10) plotCI(x=1:10,y=y,uiw=err,liw=2*err,lwd=2,col=red,scol=blue,main=Add colors to the points and error bars) but does not seem to support plotting multiple CIs but only one per point, is there a similar library somewhere but having the possibility to plot multiple CIs? I know there is the function segment but I like this one above more :) Thanks in advance, Best regards, Giovanni __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Ayuda exportar a SPSS
Hola Nose si alguien podría ayudarme a conocer por qué me sale este error cuando trato de convertir archivos de spss a R: Error en read.spss(file, use.value.labels = use.value.labels, to.data.frame = to.data.frame, : error reading portable-file dictionary Además: Warning message: In read.spss(file, use.value.labels = use.value.labels, to.data.frame = to.data.frame, : Bad character in time Bueno, agradezco su ayuda Julián [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Newbie question
If I have 3 columns of data, col 1 = Independent Var; cols 2 and 3 are Dep. Vars. I would like to produce a plot with both: col2=f(col1) and col3=f(col1). How do I do this such that I can control line parameters (line type, color, etc). I know that if I stack the data and col2 and col3 are treated as different factor levels, that I can accomplish this, but lose control over the line parameters. Any guidance is greatly appreciated. Bill __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Curve Fitting/Regression with Multiple Observations
Dear Joseph, I have had a similar experience to replies. Andy's assessment about signal to noise on the list is, I believe, quite accurate, and quite elegant. My experience has generally been that R-replies get better with age. I welcome the feedback you just provided. Sincerely, KeithC. -Original Message- From: Kyeong Soo (Joseph) Kim [mailto:kyeongsoo@gmail.com] Sent: Friday, April 30, 2010 4:10 AM To: kMan Cc: r-help@r-project.org Subject: Re: [R] Curve Fitting/Regression with Multiple Observations Dear Keith, Thanks for the suggestion and taking your time to respond to it. But, you misunderstand something and seems that you do not read all my previous e-mails. For instance, can a hand-drawing curve give you an inverse function (analytically or numerically) so that you can find an x value given the y value (not just for one, but for hundreds of points)? As for the statistical inferences, I admit that my communications were not that very clear. My intention is to get a smoothed curve from the simulation data in a statistically meaningful way as much as possible for my intended use of the resulting curve. As said before, I don't know all the thorough theoretical details behind regression and curve fitting functions available in R (know the basics though as one with PhD in Elec. Eng. unlike someone's assessment), but am doing my best to catch up reading textbooks and manuals, and posting this question to this list is definitely a way to learn from many experts and advanced users of R. By the way, I wonder why most of the responses I've received from this list are so cynical (or skeptical?) and in some sense done in a quite arrogant way. It's very hard to imagine that one would receive such responses in my own areas of computer simulation and optical communications/networking. If a newbie asks a question to the list not making much sense or another FAQ, that is usually ignored (i.e., no response) because all we are too busy to deal with that. Sometimes, though, a kind soul (like Gabor) takes his/her own valuable time and doesn't mind explaining all the details from simple basics. Again, what I want to hear from the list is the proper use of regression/curve fitting functions of R for my simulation data with replications: Applying after taking means or directly on them? So far I haven't heard anyone even specifically touching my question, although there were several seemingly related suggestions. Regards, Joseph On Fri, Apr 30, 2010 at 4:25 AM, kMan kchambe...@gmail.com wrote: Dear Joseph, If you do not need to make any inferences, that is, you just want it to look pretty, then drawing a curve by hand is as good a solution as any. Plus, there is no reason for expert testimony to say that the curve does not mean anything. Sincerely, KeithC. -Original Message- From: Kyeong Soo (Joseph) Kim [mailto:kyeongsoo@gmail.com] Sent: Tuesday, April 27, 2010 2:33 PM To: Gabor Grothendieck Cc: r-help@r-project.org Subject: Re: [R] Curve Fitting/Regression with Multiple Observations Frankly speaking, I am not looking for such a framework. The system I'm studying is a communication network (like M/M/1 queue, but way too complicated to mathematically analyze it using classical queueing theory) and the conclusion I want to make is qualitative rather than quantatitive -- a high-level comparative study of various network architectures based on the equivalence principle (a concept specific to netwokring, not in the general sense). What l want in this regard is a smooth, non-decreasing (hence one-to-one) function built out of simulation data because later in my processing, I need an inverse function of the said curve to find out an x value given the y value. That was, in fact, the reason I used the exponential (i.e., non-decreasing function) curve fiting. Even though I don't need a statistical inference framework for my work, I want to make sure that my use of regression/curve fitting techniques with my simulation data (as a tool for getting the mentioned curve) is proper and a usual practice among experts like you. To get answer to my question, I digged a lot through the Internet but found no clear explanation so far. Your suggestions and providing examples (always!) are much appreciated, but I am still not sure the use of those regression procedures with the kind of data I described is a right way to do. Again, many thanks for your prompt and kind answers, Joseph On Tue, Apr 27, 2010 at 8:46 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: If you are looking for a framework for statistical inference you could look at additive models as in the mgcv package which has a book associated with it if you need more info. e.g. library(mgcv) fm - gam(dist ~ s(speed), data = cars) summary(fm) plot(dist ~ speed, cars, pch = 20) fm.ci - with(predict(fm, se = TRUE), cbind(0, -2*se.fit, 2*se.fit) +
Re: [R] Newbie question
Hi Bill (or William) What plot do you want to create ? (scatter plot, boxplot, so on?) 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) -- On Fri, Apr 30, 2010 at 5:42 PM, William Clapham william.clap...@ars.usda.gov wrote: If I have 3 columns of data, col 1 = Independent Var; cols 2 and 3 are Dep. Vars. I would like to produce a plot with both: col2=f(col1) and col3=f(col1). How do I do this such that I can control line parameters (line type, color, etc). I know that if I stack the data and col2 and col3 are treated as different factor levels, that I can accomplish this, but lose control over the line parameters. Any guidance is greatly appreciated. Bill __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plotting multiple CIs
Hello Zahn, On Apr 30, 2010, at 4:35 PM, Ista Zahn wrote: Hi Giovanni, I think the ggplot2 package might help you out here. Do you want something like this? Thank you for your suggestion however I could not give it a try since landed in the same issue being reported about the Hmisc package: install.packages(Hmisc, dependencies=TRUE) Warning message: In getDependencies(pkgs, dependencies, available, lib) : package ‘Hmisc’ is not available library(ggplot2) library(Hmisc) Error in library(Hmisc) : there is no package called 'Hmisc' data(mtcars) p - ggplot(mtcars, aes(x=cyl, y=mpg)) p + stat_summary(fun.data = mean_cl_boot, colour = red, geom = + errorbar) + stat_summary(fun.data = mean_cl_normal, colour = + blue, geom = errorbar) Error: Hmisc package required for this functionality. Please install and try again. I am running Mac OS X Snow Leopard latest version and also have the latest R UI for Mac. How can Hmisc be installed manually? Best regards, Giovanni __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to estimate the residual SD for each sample separately in mixed-effects model?
Michal Figurski figurski at mail.med.upenn.edu writes: I am developing a Mixed-Effects model for a study of immunoassays using 'lme4' library. The study design is as follows: 10 samples were run using 7 different immunoassays, 3 times each, in duplicates. Data attached. I have developed the following model: c.lme - lmer(Result~SPL + (SPL|Assay/Run) -1, data=data) This model has excellent predictions - the Rsquared of the predicted vs measured results is almost 1, with very small RMSE. However, I am not interested in the estimates of the mean, but in SDs from the model. I access the SDs using b-VarCorr(c.lme). There: - the 'attr(b$Assay, stddev)' is the assay-to-assay SD component for each sample (SDaa) - the 'attr(b$Run, stddev)' is the run-to-run component (SDrr) - the 'attr(b, sc)' i.e. the residual (SDres), would be the within-run component, but it's a single number for all the samples. * The problem: - how to estimate the 'within-run' component (SDres) for each sample separately, as the two other components? * Solutions tried: - subtracting SDaa and SDrr from total SD - sometimes produces negative results - adding SDres to SDaa + SDrr is usually greater than total SD A couple of thoughts: * if you're going to add and subtract variance components, you ought to do it on the variance scale rather than the standard deviation scale. (i.e. to get the standard deviation of (eps_1 + eps_2) you need sqrt(Var(eps_1)+Var(eps_2)) rather than SD(eps_1)+SD(eps_2). * this model assumes that the within-run component is the SAME for all assays. If you want to allow the residual variation to be different for different assays you need to use a model that allows for heteroscedasticity in the residuals. For the foreseeable future, this can best be done in the older lme (in the nlme package) by specifying a weights= argument such as (I think) weights=varIdent(form=~1|Assay) [or something like that]. * I would be extremely interested in any pointers from other readers on ways of specifying that variance in the random-effect variances (i.e. not just the residual variance) varies among groups, treatments, etc.. I've poked through various materials (esp. Pinheiro and Bates 2000) and not been able yet to figure out how to do this -- hopefully there is some simple trick I'm missing. * Questions on mixed models are best addressed to the mixed models special-interest mailing list, r-sig-mixed-mod...@r-project.org Ben Bolker future) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] replace elements in a list
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Wincent Sent: Thursday, April 29, 2010 8:40 PM To: r help Subject: [R] replace elements in a list Dear all, I have a list like this: l - list(list(a=1,b=NULL), list(a=2,b=2)) I want to find out the elements with value of NULL and replace them with NA. I think that rapply(how=replace) ought to be able to do this but it doesn't do the right thing when the list has a NULL in it. E.g., see how the following returns a list the shape of the input list, changing all the non-NULL entries as requested, but the NULL entries are replaced by empty lists instead of 0's: rapply(l, function(x) + if(is.null(x)) 0 else paste(*, deparse(x), *, collapse=/, sep=), how=replace) [[1]] [[1]]$a [1] *1* [[1]]$b list() [[2]] [[2]]$a [1] *2* [[2]]$b [1] *2* The following function may do what you want: replaceInList - function (x, FUN, ...) { if (is.list(x)) { for (i in seq_along(x)) { x[i] - list(replaceInList(x[[i]], FUN, ...)) } x } else FUN(x, ...) } E.g., replaceInList(l, function(x)if(is.null(x))0 else x) [[1]] [[1]]$a [1] 1 [[1]]$b [1] 0 [[2]] [[2]]$a [1] 2 [[2]]$b [1] 2 Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com The actual case has a very long list, so manually find out and replace them is not an option. I can use for loop to do this, but I want to know if there is vectorized way (or other ways) to do it? Thanks -- Wincent Rong-gui HUANG Doctoral Candidate Dept of Public and Social Administration City University of Hong Kong http://asrr.r-forge.r-project.org/rghuang.html __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Newbie question
It depends on what kind of plot etc and which package you are using. The basic plot routines are summarized in ?plot.default with many of the parameters controlled by ?par I think at the simplist something like this would work and you can add colour plotting specs etc as you experiment. This assumes col1, c2 and col3 are separate vectors. plot(col, col2) lines(col1,col3) The package ggplot does very nice graphs but completely differently :) --- On Fri, 4/30/10, William Clapham william.clap...@ars.usda.gov wrote: From: William Clapham william.clap...@ars.usda.gov Subject: [R] Newbie question To: r-help@r-project.org Received: Friday, April 30, 2010, 10:42 AM If I have 3 columns of data, col 1 = Independent Var; cols 2 and 3 are Dep. Vars. I would like to produce a plot with both: col2=f(col1) and col3=f(col1). How do I do this such that I can control line parameters (line type, color, etc). I know that if I stack the data and col2 and col3 are treated as different factor levels, that I can accomplish this, but lose control over the line parameters. Any guidance is greatly appreciated. Bill __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Why do data frame column types vary across apply, lapply?
Hi, I still have little ability to predict how these functions will treat the columns of data frames: # Here's a data frame with a column a of integers, # and a column b of characters: df - data.frame( + a = 1:2, + b = c(a,b) + ) df a b 1 1 a 2 2 b # Except -- both columns are characters: apply (df, 2, typeof) a b character character # Except -- they're both integers: lapply (df, typeof) $a [1] integer $b [1] integer # Except -- only one of those integers is numeric: lapply (df, is.numeric) $a [1] TRUE $b [1] FALSE Many thanks, Jeff -- View this message in context: http://r.789695.n4.nabble.com/Why-do-data-frame-column-types-vary-across-apply-lapply-tp2077054p2077054.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem: packages TinnR, Hmisc, applications Tinn-R and R version 2.11.0
... I know, but until the new version of the package Hmisc is not released, we can go using (temporarily) the new version of R (2.11.0) with Tinn-R. Best wishes, -- ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\ Jose Claudio Faria Estatistica - prof. Titular UESC/DCET/Brasil joseclaudio.fa...@gmail.com ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\ 2010/4/30 Uwe Ligges lig...@statistik.tu-dortmund.de: ... but please note that the old Hmisc version does not pass the checks under R-2.11.0. This has been discussed several times on the lists both yesterday and today. Best wishes, Uwe Ligges Am 30.04.2010 13:20, schrieb Jose Claudio Faria: Hi, First: sorry for my bad English! I have received several emails reporting problems using Tinn-R with the new R version (2.11.0). This email is meant to assist the users. This problem is new and is related with R 2.11.0 and Hmisc package for Windows! After download and install R 2.11.0pat under Linux and Windows, see below my results: a) Under Linux (Open SUSE 11.3) - I found no problem installing, compiling and using these packages: TinnR, Hmisc, R2HTML and svSocket. b) Under Windows (Vista Ultimate) - after to set the file Rprofile.site with the script (generated by Tinn-R, i.e, main menu R/Configure/Permanent (Rprofile.site), see below: ##=== ## Tinn-R: necessary packages and functions ## Tinn-R:= 2.2.0.2 with TinnR package= 1.0.3 ##=== ## Set the URL of the preferred repository, below some examples: options(repos='http://software.rc.fas.harvard.edu/mirrors/R/') # USA #options(repos='http://cran.ma.imperial.ac.uk/') # UK #options(repos='http://brieger.esalq.usp.br/CRAN/') # Brazil library(utils) ## Check necessary packages necessary- c('TinnR', 'svSocket') installed- necessary %in% installed.packages()[, 'Package'] if (length(necessary[!installed])=1) install.packages(necessary[!installed]) ## Load packages library(TinnR) library(svSocket) ## Uncoment the two lines below if you want Tinn-R to always start R at start-up ## (Observation: check the path of Tinn-R.exe) #options(IDE='C:/Tinn-R/bin/Tinn-R.exe') #trStartIDE() ## Set options options(use.DDE=T) ## Start DDE trDDEInstall() .trPaths- paste(paste(Sys.getenv('APPDATA'), '\\Tinn-R\\tmp\\', sep=''), c('', 'search.txt', 'objects.txt', 'file.r', 'selection.r', 'block.r', 'lines.r'), sep='') #=== when R was rebooted I received the messages below: IO: #=== R version 2.11.0 Patched (2010-04-26 r51822) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. #=== Log: #=== Warning: dependency 'Hmisc' is not available also installing the dependencies 'R2HTML', 'svMisc' trying URL 'http://software.rc.fas.harvard.edu/mirrors/R/bin/windows/contrib/2.11/R2HTML_2.0.0.zip' length 464688 bytes (453 Kb) opened URL downloaded 453 Kb trying URL 'http://software.rc.fas.harvard.edu/mirrors/R/bin/windows/contrib/2.11/svMisc_0.9-57.zip' length 134502 bytes (131 Kb) opened URL downloaded 131 Kb trying URL 'http://software.rc.fas.harvard.edu/mirrors/R/bin/windows/contrib/2.11/TinnR_1.0.3.zip' length 37715 bytes (36 Kb) opened URL downloaded 36 Kb trying URL 'http://software.rc.fas.harvard.edu/mirrors/R/bin/windows/contrib/2.11/svSocket_0.9-48.zip' length 59065 bytes (57 Kb) opened URL downloaded 57 Kb Loading required package: tcltk done Loading required package: Hmisc Error: package 'Hmisc' could not be loaded In addition: Warning message: In library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc) : there is no package called 'Hmisc' #=== So, the main problem is related with the package 'Hmisc' under Windows! I closed the R. I did a copy/paste from my previous Hmisc package ('library' of my old R version: R-2.10.0pat) to the folder 'library' of my new R version: R-2.11.0pat. So, I rebooted R newly and below the results: IO: #=== R version 2.11.0 Patched (2010-04-26 r51822) Copyright (C)
[R] Help importing data from SPSS
Hi When I try to import data from SPSS I have the next warning message: Error in read.spss(file, use.value.labels = use.value.labels, to.data.frame = to.data.frame, : error reading portable-file dictionary Warning message: In read.spss(file, use.value.labels = use.value.labels, to.data.frame = to.data.frame, : Bad character in time Thank you for your help Julián [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Ayuda exportar a SPSS
Hola, ¿qué tal? Si quieres preguntar en español, puedes hacerlo a través de r-help-es: https://stat.ethz.ch/mailman/listinfo/r-help-es Un saludo, Carlos J. Gil Bellosta http://www.datanalytics.com P.D.: Es difícil que te podamos ayudar si no nos ofreces más detalles... On 04/30/2010 04:37 PM, Julián Escobar wrote: Hola Nose si alguien podría ayudarme a conocer por qué me sale este error cuando trato de convertir archivos de spss a R: Error en read.spss(file, use.value.labels = use.value.labels, to.data.frame = to.data.frame, : error reading portable-file dictionary Además: Warning message: In read.spss(file, use.value.labels = use.value.labels, to.data.frame = to.data.frame, : Bad character in time Bueno, agradezco su ayuda Julián [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Why do data frame column types vary across apply, lapply?
Hi, On Fri, Apr 30, 2010 at 12:08 PM, Jeff Brown dopethatwantsc...@yahoo.comwrote: Hi, I still have little ability to predict how these functions will treat the columns of data frames: # Here's a data frame with a column a of integers, # and a column b of characters: df - data.frame( + a = 1:2, + b = c(a,b) + ) df a b 1 1 a 2 2 b # Except -- both columns are characters: apply (df, 2, typeof) a b character character apply converts all to character # Except -- they're both integers: lapply (df, typeof) $a [1] integer $b [1] integer data.frame has a argument 'stringsAsFactors', this converts character columns to factor columns. Factors are integers with labels # Except -- only one of those integers is numeric: lapply (df, is.numeric) $a [1] TRUE $b [1] FALSE df$b is a factor. Many thanks, Jeff -- View this message in context: http://r.789695.n4.nabble.com/Why-do-data-frame-column-types-vary-across-apply-lapply-tp2077054p2077054.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] a question on autocorrelation acf
Thanks, Duncan, but there are no reference in ?acf. The only probably related stuff is Author(s): Original: Paul Gilbert, Martyn Plummer. Extensive modifications and univariate case of 'pacf' by B.D. Ripley. And I didn't find anything with google search of it. On Thu, Apr 29, 2010 at 7:08 PM, Duncan Murdoch murdoch.dun...@gmail.comwrote: On 29/04/2010 6:22 PM, zhenjiang xu wrote: Hi R users, where can I find the equations used by acf function to calculate autocorrelation? See the reference listed in ?acf. Duncan Murdoch I think I misunderstand acf. Doesn't acf use following equation to calculate autocorrelation? [image: R(\tau) = \frac{\operatorname{E}[(X_t - \mu)(X_{t+\tau} - \mu)]}{\sigma^2}\, ,] If it does, then the autocorrelation of a sine function should give a cosine; however, the following code gives a cosine-shape function with its magnitude decreasing along the lag. x = c(1:500) x = x/10 x = sin(x) acf(x, type='correlation', lag.max=length(x)-1) -- Best, Zhenjiang [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Why do data frame column types vary across apply, lapply?
I still have little ability to predict how these functions will treat the columns of data frames: All of this is explained by knowing what class of data functions *work on*, and what class of data *you have*. # Here's a data frame with a column a of integers, # and a column b of characters: df - data.frame( + a = 1:2, + b = c(a,b) + ) df a b 1 1 a 2 2 b First, let's see what we have? Use str(df) str(df) 'data.frame': 2 obs. of 2 variables: $ a: int 1 2 $ b: Factor w/ 2 levels a,b: 1 2 So we have a data.frame with two variables, one of class integer and one of class factor. Notice how neither are of class character. # Except -- both columns are characters: apply (df, 2, typeof) a b character character See ?apply. The apply function works on *matrices*. You're not passing it a matrix, you're passing a data.frame. Matrices are two dimensional vectors and are of *ONE* type. So apply could either 1) report an error saying give me a matrix or 2) try to convert whatever you gave it to a matrix. Apply does (2), and converts it to the best thing it can, a character matrix. It can't be a numeric matrix since you have mixed types of data, so it goes to the lowest common denominator, a matrix of characters. This is all explained in the first paragraph of ?apply. # Except -- they're both integers: lapply (df, typeof) $a [1] integer $b [1] integer ?typeof is probably not very useful for casual R use. I've never used it. More useful is ?class. ?typeof is showing you how R is storing this stuff low-level. Factors are just integer codes with labels, and you have an integer variable and a factor variable, thus ?typeof reports both integers. Try lapply(df, class) # Except -- only one of those integers is numeric: lapply (df, is.numeric) $a [1] TRUE $b [1] FALSE Yes, because you have a factor, and in the first 3 paragraphs of ?as.numeric, you'd see: Factors are handled by the default method, and there are methods for classes ‘Date’ and ‘POSIXt’ (in all three cases the result is false). Methods for ‘is.numeric’ should only return true if the base type of the class is ‘double’ or ‘integer’ _and_ values can reasonably be regarded as numeric (e.g. arithmetic on them makes sense). See, it all makes perfect sense :). My advice? Don't worry about typeof. *Always* know what class your objects are, and what class the functions you're using expect. Use ?str liberally. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] dump not evaluating promises?
D Sonderegger wrote: What I was expecting was for the second dump was: foo - structure(c(1,2,3,4,5,6), .Dim = c(2L, 3L)) That is, I was expecting dump to expand the 1:6 and 2:3 into the actual vectors. Well, dput(c(1,2,3)) c(1, 2, 3) dput(c(1L,2L,3L)) 1:3 And dump() does likewise. -- Peter Dalgaard Center for Statistics, Copenhagen Business School Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Why do data frame column types vary across apply, lapply?
See ?apply. The apply function works on *matrices*. Actually arrays, and matrices are arrays with 2 dimensions. characters. This is all explained in the first paragraph of ?apply. Also see ?as.matrix __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] dopar parallel assignments
Hi Vivek, On Thu, Apr 29, 2010 at 8:37 PM, Vivek Ayer vivek.a...@gmail.com wrote: Hi David, Thanks for the help. It's working! I still find it to be a new concept. I haven't encountered storing loops in objects in any other languages. Can it even be done in other languages? Very novel, quite intriguing. Yes, this idiom is quite frequently used in functional languages. You're not actually storing loops in objects, per se, though. Its somehow analogous to the map function, where you're traversing an input list of things/objects, and creating a new list of objects by transforming them. If you're familiar with python, think list comprehensions. In your use case, your inputs are just sequence/index numbers, so it's not as natural to think of them this way, but imagine something like this: words - c('one', 'two', 'three') capitalized - for (word=words) %do% someCapitalizeFunction(word) which might give you c(One, Two, Three) This is just a pedagogical example, of course, but hopefully it helps to clear things up a bit? You're not storing loops in objects, but rather storing the transformed objects from your input list into a new list. -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] a question on autocorrelation acf
I think you are Googling the wrong reference. Note in ?acf the following: References: Venables, W. N. and Ripley, B. D. (2002) _Modern Applied Statistics with S_. Fourth Edition. Springer-Verlag. (This contains the exact definitions used.) On Fri, Apr 30, 2010 at 10:42 AM, zhenjiang xu zhenjiang...@gmail.com wrote: Thanks, Duncan, but there are no reference in ?acf. The only probably related stuff is Author(s): Original: Paul Gilbert, Martyn Plummer. Extensive modifications and univariate case of 'pacf' by B.D. Ripley. And I didn't find anything with google search of it. On Thu, Apr 29, 2010 at 7:08 PM, Duncan Murdoch murdoch.dun...@gmail.comwrote: On 29/04/2010 6:22 PM, zhenjiang xu wrote: Hi R users, where can I find the equations used by acf function to calculate autocorrelation? See the reference listed in ?acf. Duncan Murdoch I think I misunderstand acf. Doesn't acf use following equation to calculate autocorrelation? [image: R(\tau) = \frac{\operatorname{E}[(X_t - \mu)(X_{t+\tau} - \mu)]}{\sigma^2}\, ,] If it does, then the autocorrelation of a sine function should give a cosine; however, the following code gives a cosine-shape function with its magnitude decreasing along the lag. x = c(1:500) x = x/10 x = sin(x) acf(x, type='correlation', lag.max=length(x)-1) -- Best, Zhenjiang [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- John A. Ramey, M.S. Ph.D. Candidate Department of Statistics Baylor University __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] re.findall equivalent?
Hi, The regular expression (grep) below does not behave at all like the equivalent in Python. Also, I would be happy if somebody could tell me what the R equivalent for Python's re.findall is. The regex filters out any numbers not enclosed by square brackets, including fractions (with either comma or dot as the separator) and percentages. How should the R code below be modified so it does the same as the Python code? # python code import re pattern = [^[[]([0-9]+[,.%]?[0-9]*)[^]]? formula = =832.1*R[1]K[1]*R[2]K[1]*25% re.findall(pattern, formula) ['832.1', '25%'] # partial R code formula - =832,1*R[1]K[1]*R[2]K[1]*25% pattern - [^[[]([0-9]+[,.%]?[0-9]*)[^]]? grep(pattern, formula, value=TRUE, perl=TRUE) [1] =832,1*R[1]K[1]*R[2]K[1]*25% Thank you, and have a good weekend! Cheers!! Albert-Jan ~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us? ~~ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] short question about data frame manipulation
Hi: On Fri, Apr 30, 2010 at 6:08 AM, arnaud Gaboury arnaud.gabo...@gmail.comwrote: Dear group, I am losing my mind with a simple question. Sorry if obvious, but I maybe start to be confused after days and days of reading documentations. Df : df - structure(list(a = 1:3, b = 4:6, c = structure(c(1L, 1L, 1L), class = factor, .Label = w)), .Names = c(a, b, c), row.names = c(NA, -3L), class = data.frame) I want to multiply first and second by -1. x$a-x$a*-1 x$b-x$b*-1 This is a rather dangerous syntax; if you must write it this way, it's better to enclose the -1 in parentheses so that the intent is clear. One way is, as others have suggested, x[, 1:2] - x[, 1:2] * (-1) For this example, it's just as simple to write x[, 1:2] - -df[, 1:2] and note that I made sure to space between the assignment and the minus sign for readability... HTH, Dennis This returns what I want, but there must be an one line command to do it, right? TY for help __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plotting multiple CIs
Hello David, On Apr 30, 2010, at 6:00 PM, David Winsemius wrote: Looks like you do not have the RTools bundle and perhaps not the XCode framework either? I am not suggesting that you do so, since it appears you are not conversant with compiling source code packages. If I am wrong about that point, then this is where you would get the gfortran compiler that Simon uses: http://r.research.att.com/tools/ My advice would be to go back to R.2.10.1 if you need Rcmdr. I do have Xcode latest but not RTools. This below was my last failed attempt. Best regards, Giovanni install.packages(Hmisc, dependencies=TRUE, type =source) trying URL 'http://cran.ch.r-project.org/src/contrib/Hmisc_3.7-0.tar.gz' Content type 'application/x-gzip' length 563054 bytes (549 Kb) opened URL == downloaded 549 Kb * installing *source* package Hmisc ... ** libs ** arch - i386 gcc -arch i386 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -I/usr/local/include -fPIC -g -O2 -c Hmisc.c -o Hmisc.o gfortran -arch i386 -fPIC -g -O2 -c cidxcn.f -o cidxcn.o make: gfortran: No such file or directory make: *** [cidxcn.o] Error 1 ERROR: compilation failed for package Hmisc * removing /Library/Frameworks/R.framework/Versions/2.11/Resources/library/Hmisc The downloaded packages are in /private/var/folders/5m/5mC0wYCSGMK8NbPZYhBEZE+++TI/-Tmp-/Rtmpz0R5nY/downloaded_packages Updating HTML index of packages in '.Library' Warning message: In install.packages(Hmisc, dependencies = TRUE, type = source) : installation of package 'Hmisc' had non-zero exit status [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] dump not evaluating promises?
dump and dput but have the same behavior but dump has an extra option 'evaluate'. From the documentation, 'evaluate=TRUE' looks like it should force promises to be evaluated, ie convert 1:6 to be c(1,2,3,4,5,6). I think that either my understanding of what a 'promise' is and what it means to be evaluated is flawed, or the evaluate option in the dump command is broken. -- View this message in context: http://r.789695.n4.nabble.com/dump-not-evaluating-promises-tp2075859p2077140.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] re.findall equivalent?
UNIX grep selects out lines in a file and R grep similarly selects out components of a vector of strings.On the other hand re.findall extracts substrings from strings. These are different concepts so there is no logical reason to expect that these two sets of commands behave the same. Instead, try this: library(gsubfn) text - =832,1*R[1]K[1]*R[2]K[1]*25% pat - [^[[]([0-9]+[,.%]?[0-9]*)[^]]? strapply(text, pat, c)[[1]] [1] 832,1 25% On Fri, Apr 30, 2010 at 11:59 AM, Albert-Jan Roskam fo...@yahoo.com wrote: Hi, The regular expression (grep) below does not behave at all like the equivalent in Python. Also, I would be happy if somebody could tell me what the R equivalent for Python's re.findall is. The regex filters out any numbers not enclosed by square brackets, including fractions (with either comma or dot as the separator) and percentages. How should the R code below be modified so it does the same as the Python code? # python code import re pattern = [^[[]([0-9]+[,.%]?[0-9]*)[^]]? formula = =832.1*R[1]K[1]*R[2]K[1]*25% re.findall(pattern, formula) ['832.1', '25%'] # partial R code formula - =832,1*R[1]K[1]*R[2]K[1]*25% pattern - [^[[]([0-9]+[,.%]?[0-9]*)[^]]? grep(pattern, formula, value=TRUE, perl=TRUE) [1] =832,1*R[1]K[1]*R[2]K[1]*25% Thank you, and have a good weekend! Cheers!! Albert-Jan ~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us? ~~ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] help needed with help
I installed R version 2.11.0 (2010-04-22) on may macbook (snow leopard) and run R from within emacs Now when I try to get help, I get ?lm (in the new help window) Error in help(lm, htmlhelp = FALSE) : unused argument(s) (htmlhelp = FALSE) Help! p.s. I am running: This is GNU Emacs 22.2.50.1 (i386-apple-darwin9.4.0, Carbon Version 1.6.0) of 2008-07-17 on seijiz.local --- Trevor Hastie has...@stanford.edu Professor, Department of Statistics, Stanford University Phone: (650) 725-2231 (Statistics) Fax: (650) 725-8977 (650) 498-5233 (Biostatistics) Fax: (650) 725-6951 URL: http://www-stat.stanford.edu/~hastie address: room 104, Department of Statistics, Sequoia Hall 390 Serra Mall, Stanford University, CA 94305-4065 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] decisions.values meaning in SVM
HI, Dear R community, I have 1 and 0 outcome in data set, I used the SVM (e1071). what is the meaning of 1/0 in the decision.values? if the decision.values0 then it will class to 1, and if decision.values0, then it will classify to 0, is this right? attributes(svm.pred)$decision.values 1/0 161.4363935596 230.5238457402 430.3074995010 521.9586635525 551.7276312484 751.7023838348 821.1030645557 120 0.3641599926 128 0.3388179694 147 0.4199537672 148 1.5311047874 153 2.5191302738 161 2.3069697377 162 0.9179497841 172 1.0192415342 176 1.3536947861 215 0.9405960067 222 0.9792365851 255 1.2270351367 267 1.7377883390 279 1.1427732884 282 1.2548137295 292 1.1336236065 320 0.4953096976 333 1.0867080386 338 2.5335080606 -- Sincerely, Changbin -- Changbin Du DOE Joint Genome Institute Bldg 400 Rm 457 2800 Mitchell Dr Walnut Creet, CA 94598 Phone: 925-927-2856 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] SOLVED plotting multiple CIs
Hello, After installing gfortran from http://r.research.att.com/gfortran-4.2.3.dmg it finally works! see below. Thank you all. @Ista Zahn: Looks fantastic! :) thank you so much! ... is there a way to have a small circle on the true value? Best regards, Giovanni install.packages(Hmisc, dependencies=TRUE, type =source) trying URL 'http://cran.ch.r-project.org/src/contrib/Hmisc_3.7-0.tar.gz' Content type 'application/x-gzip' length 563054 bytes (549 Kb) opened URL == downloaded 549 Kb * installing *source* package ‘Hmisc’ ... ** libs ** arch - i386 gcc -arch i386 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -I/usr/local/include -fPIC -g -O2 -c Hmisc.c -o Hmisc.o gfortran -arch i386 -fPIC -g -O2 -c cidxcn.f -o cidxcn.o gfortran -arch i386 -fPIC -g -O2 -c cidxcp.f -o cidxcp.o gfortran -arch i386 -fPIC -g -O2 -c hoeffd.f -o hoeffd.o gfortran -arch i386 -fPIC -g -O2 -c jacklins.f -o jacklins.o gfortran -arch i386 -fPIC -g -O2 -c largrec.f -o largrec.o gcc -arch i386 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -I/usr/local/include -fPIC -g -O2 -c mChoice.c -o mChoice.o gcc -arch i386 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -I/usr/local/include -fPIC -g -O2 -c nstr.c -o nstr.o gcc -arch i386 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -I/usr/local/include -fPIC -g -O2 -c ranksort.c -o ranksort.o gfortran -arch i386 -fPIC -g -O2 -c rcorr.f -o rcorr.o gcc -arch i386 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -I/usr/local/include -fPIC -g -O2 -c string_box.c -o string_box.o gfortran -arch i386 -fPIC -g -O2 -c wclosest.f -o wclosest.o gcc -arch i386 -std=gnu99 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o Hmisc.so Hmisc.o cidxcn.o cidxcp.o hoeffd.o jacklins.o largrec.o mChoice.o nstr.o ranksort.o rcorr.o string_box.o wclosest.o -lgfortran -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation installing to /Library/Frameworks/R.framework/Versions/2.11/Resources/library/Hmisc/libs/i386 ** arch - x86_64 gcc -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -I/usr/local/include-fPIC -g -O2 -c Hmisc.c -o Hmisc.o gfortran -arch x86_64 -fPIC -g -O2 -c cidxcn.f -o cidxcn.o gfortran -arch x86_64 -fPIC -g -O2 -c cidxcp.f -o cidxcp.o gfortran -arch x86_64 -fPIC -g -O2 -c hoeffd.f -o hoeffd.o gfortran -arch x86_64 -fPIC -g -O2 -c jacklins.f -o jacklins.o gfortran -arch x86_64 -fPIC -g -O2 -c largrec.f -o largrec.o gcc -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -I/usr/local/include-fPIC -g -O2 -c mChoice.c -o mChoice.o gcc -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -I/usr/local/include-fPIC -g -O2 -c nstr.c -o nstr.o gcc -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -I/usr/local/include-fPIC -g -O2 -c ranksort.c -o ranksort.o gfortran -arch x86_64 -fPIC -g -O2 -c rcorr.f -o rcorr.o gcc -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -I/usr/local/include-fPIC -g -O2 -c string_box.c -o string_box.o gfortran -arch x86_64 -fPIC -g -O2 -c wclosest.f -o wclosest.o gcc -arch x86_64 -std=gnu99 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o Hmisc.so Hmisc.o cidxcn.o cidxcp.o hoeffd.o jacklins.o largrec.o mChoice.o nstr.o ranksort.o rcorr.o string_box.o wclosest.o -lgfortran -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation installing to /Library/Frameworks/R.framework/Versions/2.11/Resources/library/Hmisc/libs/x86_64 ** R ** inst ** preparing package for lazy loading Loading required package: splines ** help *** installing help indices ** building package indices ... ** testing if installed package can be loaded * DONE (Hmisc) The downloaded packages are in ‘/private/var/folders/5m/5mC0wYCSGMK8NbPZYhBEZE+++TI/-Tmp-/Rtmpz0R5nY/downloaded_packages’ Updating HTML index of packages in '.Library' __ R-help@r-project.org mailing list
Re: [R] help needed with help
On Apr 30, 2010, at 11:20 AM, Trevor Hastie wrote: I installed R version 2.11.0 (2010-04-22) on may macbook (snow leopard) and run R from within emacs Now when I try to get help, I get ?lm (in the new help window) Error in help(lm, htmlhelp = FALSE) : unused argument(s) (htmlhelp = FALSE) Help! p.s. I am running: This is GNU Emacs 22.2.50.1 (i386-apple-darwin9.4.0, Carbon Version 1.6.0) of 2008-07-17 on seijiz.local Prof. Hastie, Presumably somewhere in your~/.emacs file you may have a reference to: (setq inferior-ess-r-help-command ...) Either add the following or replace the above if present, with: (setq inferior-ess-r-help-command help(\%s\, help_type=\html\)\n) Note that the above requires ESS 5.5 or greater. If you are interested Vincent Goulet has a binary DMG for Emacs 23 and ESS 5.8 here: http://vgoulet.act.ulaval.ca/en/ressources/emacs/mac which might save you some time if you wish to update Emacs. I don't use it as I build Emacs 23 from CVS, but a quick look suggests that he might not yet have added the above help fix for R 2.11.0. HTH, Marc Schwartz __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] SOLVED plotting multiple CIs
Glad you got it working! By true value do you mean the means? If so: library(ggplot2) data(mtcars) p - ggplot(mtcars, aes(x=cyl, y=mpg)) p + stat_summary(fun.data = mean_cl_boot, colour = red, geom = errorbar) + stat_summary(fun.data = mean_cl_normal, colour = blue, geom = errorbar) + geom_point(stat=summary, fun.y = mean) Best, Ista On Fri, Apr 30, 2010 at 12:33 PM, Giovanni Azua brave...@gmail.com wrote: Hello, After installing gfortran from http://r.research.att.com/gfortran-4.2.3.dmg it finally works! see below. Thank you all. @Ista Zahn: Looks fantastic! :) thank you so much! ... is there a way to have a small circle on the true value? Best regards, Giovanni install.packages(Hmisc, dependencies=TRUE, type =source) trying URL 'http://cran.ch.r-project.org/src/contrib/Hmisc_3.7-0.tar.gz' Content type 'application/x-gzip' length 563054 bytes (549 Kb) opened URL == downloaded 549 Kb * installing *source* package ‘Hmisc’ ... ** libs ** arch - i386 gcc -arch i386 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -I/usr/local/include -fPIC -g -O2 -c Hmisc.c -o Hmisc.o gfortran -arch i386 -fPIC -g -O2 -c cidxcn.f -o cidxcn.o gfortran -arch i386 -fPIC -g -O2 -c cidxcp.f -o cidxcp.o gfortran -arch i386 -fPIC -g -O2 -c hoeffd.f -o hoeffd.o gfortran -arch i386 -fPIC -g -O2 -c jacklins.f -o jacklins.o gfortran -arch i386 -fPIC -g -O2 -c largrec.f -o largrec.o gcc -arch i386 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -I/usr/local/include -fPIC -g -O2 -c mChoice.c -o mChoice.o gcc -arch i386 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -I/usr/local/include -fPIC -g -O2 -c nstr.c -o nstr.o gcc -arch i386 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -I/usr/local/include -fPIC -g -O2 -c ranksort.c -o ranksort.o gfortran -arch i386 -fPIC -g -O2 -c rcorr.f -o rcorr.o gcc -arch i386 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -I/usr/local/include -fPIC -g -O2 -c string_box.c -o string_box.o gfortran -arch i386 -fPIC -g -O2 -c wclosest.f -o wclosest.o gcc -arch i386 -std=gnu99 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o Hmisc.so Hmisc.o cidxcn.o cidxcp.o hoeffd.o jacklins.o largrec.o mChoice.o nstr.o ranksort.o rcorr.o string_box.o wclosest.o -lgfortran -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation installing to /Library/Frameworks/R.framework/Versions/2.11/Resources/library/Hmisc/libs/i386 ** arch - x86_64 gcc -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -I/usr/local/include -fPIC -g -O2 -c Hmisc.c -o Hmisc.o gfortran -arch x86_64 -fPIC -g -O2 -c cidxcn.f -o cidxcn.o gfortran -arch x86_64 -fPIC -g -O2 -c cidxcp.f -o cidxcp.o gfortran -arch x86_64 -fPIC -g -O2 -c hoeffd.f -o hoeffd.o gfortran -arch x86_64 -fPIC -g -O2 -c jacklins.f -o jacklins.o gfortran -arch x86_64 -fPIC -g -O2 -c largrec.f -o largrec.o gcc -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -I/usr/local/include -fPIC -g -O2 -c mChoice.c -o mChoice.o gcc -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -I/usr/local/include -fPIC -g -O2 -c nstr.c -o nstr.o gcc -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -I/usr/local/include -fPIC -g -O2 -c ranksort.c -o ranksort.o gfortran -arch x86_64 -fPIC -g -O2 -c rcorr.f -o rcorr.o gcc -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -I/usr/local/include -fPIC -g -O2 -c string_box.c -o string_box.o gfortran -arch x86_64 -fPIC -g -O2 -c wclosest.f -o wclosest.o gcc -arch x86_64 -std=gnu99 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o Hmisc.so Hmisc.o cidxcn.o cidxcp.o hoeffd.o jacklins.o largrec.o mChoice.o nstr.o ranksort.o rcorr.o string_box.o wclosest.o -lgfortran -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation installing to /Library/Frameworks/R.framework/Versions/2.11/Resources/library/Hmisc/libs/x86_64
Re: [R] dump not evaluating promises?
On 30/04/2010 12:07 PM, D Sonderegger wrote: dump and dput but have the same behavior but dump has an extra option 'evaluate'. From the documentation, 'evaluate=TRUE' looks like it should force promises to be evaluated, ie convert 1:6 to be c(1,2,3,4,5,6). Both 1:6 and c(1,2,3,4,5,6) are expressions, and they evaluate to different things. (1:6 is an integer vector, the other is a numeric vector, stored in floating point.) dump() is just trying to give more concise output. Look more closely at Peter's example. Duncan Murdoch I think that either my understanding of what a 'promise' is and what it means to be evaluated is flawed, or the evaluate option in the dump command is broken. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Curve Fitting/Regression with Multiple Observations
Dear Andy, You're the kind soul I mentioned in my previous e-mail! Certainly yours is the kind of response I've been looking for, and now I can start with that, especially splinefun() with monoH.FC method. As for my simulation data, your understanding is correct; there are multiple y values from different replications for the same x values. Even though there are multiple y values for a given x value, this could be interpreted as the combination of multiple, different random components (inherent in any monte carlo simulation) + one fixed, unknown deterministic component. So underlying assumption is that there is a one-to-one (monotone) function between x and y. This is typical in many computer simulation in networking. As said before, for instance, you can get a nice, closed-form (monotone) function of utilization (i.e., \rho) for the average delay of customers in the queueing system in M/M/1 queue. The simulation with different random seeds, however, gives slightly different average delays for a given utilization per run. Still, we know from the underlying model that there is one-to-one correspondence between the utilization and the average delay. Of course, unlike the simple M/M/1 queue, for most of actual networking systems to analyze, we don't know the exact models, but it is well accepted and assumed in nearly all existing work in this area that there is still one-to-one correspondence between the utilization (or system load) and performance measures like delay, throughput, and packet loss. I do appreciate your suggestion and this would be of tremendous help for my current research. Also, thanks for the assessment on this list, which I take as a valuable advice in the future. With Regards, Joseph On Fri, Apr 30, 2010 at 12:52 PM, Liaw, Andy andy_l...@merck.com wrote: You may want to run RSiteSearch(monotone splines) at the R prompt. The 3rd hit looks quite promising. However, if I understand your data, you have multiple y values for the same x values. If so, can you justify inverting the regression function? The traffic on this mailing list is very high, and the signal to noise ratio is rather low. This has the tendency of burning out those who started with good intentions to help. Andy From: Kyeong Soo (Joseph) Kim Dear Keith, Thanks for the suggestion and taking your time to respond to it. But, you misunderstand something and seems that you do not read all my previous e-mails. For instance, can a hand-drawing curve give you an inverse function (analytically or numerically) so that you can find an x value given the y value (not just for one, but for hundreds of points)? As for the statistical inferences, I admit that my communications were not that very clear. My intention is to get a smoothed curve from the simulation data in a statistically meaningful way as much as possible for my intended use of the resulting curve. As said before, I don't know all the thorough theoretical details behind regression and curve fitting functions available in R (know the basics though as one with PhD in Elec. Eng. unlike someone's assessment), but am doing my best to catch up reading textbooks and manuals, and posting this question to this list is definitely a way to learn from many experts and advanced users of R. By the way, I wonder why most of the responses I've received from this list are so cynical (or skeptical?) and in some sense done in a quite arrogant way. It's very hard to imagine that one would receive such responses in my own areas of computer simulation and optical communications/networking. If a newbie asks a question to the list not making much sense or another FAQ, that is usually ignored (i.e., no response) because all we are too busy to deal with that. Sometimes, though, a kind soul (like Gabor) takes his/her own valuable time and doesn't mind explaining all the details from simple basics. Again, what I want to hear from the list is the proper use of regression/curve fitting functions of R for my simulation data with replications: Applying after taking means or directly on them? So far I haven't heard anyone even specifically touching my question, although there were several seemingly related suggestions. Regards, Joseph On Fri, Apr 30, 2010 at 4:25 AM, kMan kchambe...@gmail.com wrote: Dear Joseph, If you do not need to make any inferences, that is, you just want it to look pretty, then drawing a curve by hand is as good a solution as any. Plus, there is no reason for expert testimony to say that the curve does not mean anything. Sincerely, KeithC. -Original Message- From: Kyeong Soo (Joseph) Kim [mailto:kyeongsoo@gmail.com] Sent: Tuesday, April 27, 2010 2:33 PM To: Gabor Grothendieck Cc: r-help@r-project.org Subject: Re: [R] Curve Fitting/Regression with Multiple Observations Frankly speaking, I am not looking for such a framework. The system I'm studying is a communication
Re: [R] Curve Fitting/Regression with Multiple Observations
Dear Keith, I will keep that in mind in my future posting. Again, thanks for your time and advice! Regards, Joseph On Fri, Apr 30, 2010 at 3:54 PM, kMan kchambe...@gmail.com wrote: Dear Joseph, I have had a similar experience to replies. Andy's assessment about signal to noise on the list is, I believe, quite accurate, and quite elegant. My experience has generally been that R-replies get better with age. I welcome the feedback you just provided. Sincerely, KeithC. -Original Message- From: Kyeong Soo (Joseph) Kim [mailto:kyeongsoo@gmail.com] Sent: Friday, April 30, 2010 4:10 AM To: kMan Cc: r-help@r-project.org Subject: Re: [R] Curve Fitting/Regression with Multiple Observations Dear Keith, Thanks for the suggestion and taking your time to respond to it. But, you misunderstand something and seems that you do not read all my previous e-mails. For instance, can a hand-drawing curve give you an inverse function (analytically or numerically) so that you can find an x value given the y value (not just for one, but for hundreds of points)? As for the statistical inferences, I admit that my communications were not that very clear. My intention is to get a smoothed curve from the simulation data in a statistically meaningful way as much as possible for my intended use of the resulting curve. As said before, I don't know all the thorough theoretical details behind regression and curve fitting functions available in R (know the basics though as one with PhD in Elec. Eng. unlike someone's assessment), but am doing my best to catch up reading textbooks and manuals, and posting this question to this list is definitely a way to learn from many experts and advanced users of R. By the way, I wonder why most of the responses I've received from this list are so cynical (or skeptical?) and in some sense done in a quite arrogant way. It's very hard to imagine that one would receive such responses in my own areas of computer simulation and optical communications/networking. If a newbie asks a question to the list not making much sense or another FAQ, that is usually ignored (i.e., no response) because all we are too busy to deal with that. Sometimes, though, a kind soul (like Gabor) takes his/her own valuable time and doesn't mind explaining all the details from simple basics. Again, what I want to hear from the list is the proper use of regression/curve fitting functions of R for my simulation data with replications: Applying after taking means or directly on them? So far I haven't heard anyone even specifically touching my question, although there were several seemingly related suggestions. Regards, Joseph On Fri, Apr 30, 2010 at 4:25 AM, kMan kchambe...@gmail.com wrote: Dear Joseph, If you do not need to make any inferences, that is, you just want it to look pretty, then drawing a curve by hand is as good a solution as any. Plus, there is no reason for expert testimony to say that the curve does not mean anything. Sincerely, KeithC. -Original Message- From: Kyeong Soo (Joseph) Kim [mailto:kyeongsoo@gmail.com] Sent: Tuesday, April 27, 2010 2:33 PM To: Gabor Grothendieck Cc: r-help@r-project.org Subject: Re: [R] Curve Fitting/Regression with Multiple Observations Frankly speaking, I am not looking for such a framework. The system I'm studying is a communication network (like M/M/1 queue, but way too complicated to mathematically analyze it using classical queueing theory) and the conclusion I want to make is qualitative rather than quantatitive -- a high-level comparative study of various network architectures based on the equivalence principle (a concept specific to netwokring, not in the general sense). What l want in this regard is a smooth, non-decreasing (hence one-to-one) function built out of simulation data because later in my processing, I need an inverse function of the said curve to find out an x value given the y value. That was, in fact, the reason I used the exponential (i.e., non-decreasing function) curve fiting. Even though I don't need a statistical inference framework for my work, I want to make sure that my use of regression/curve fitting techniques with my simulation data (as a tool for getting the mentioned curve) is proper and a usual practice among experts like you. To get answer to my question, I digged a lot through the Internet but found no clear explanation so far. Your suggestions and providing examples (always!) are much appreciated, but I am still not sure the use of those regression procedures with the kind of data I described is a right way to do. Again, many thanks for your prompt and kind answers, Joseph On Tue, Apr 27, 2010 at 8:46 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: If you are looking for a framework for statistical inference you could look at additive models as in the mgcv package which has a
[R] Problem with format(,%G-%V) - Segfault
Hi, I've some problems with the new R version converting date to year-week: R version 2.11.0 (2010-04-22) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 load(test.data.R) str(test.data) Class 'Date' num [1:3599546] 13888 14166 14188 14189 14189 ... result - format(test.data, format=%G-%V) Error: segfault from C stack overflow this happens with a self compiled R version and the debian packages. The same operation works with R 2.9.x and R 2.10.x I've attached the backtrace. kind regards, Matthias Core was generated by `/opt/R/lib64/R/bin/exec/R --vanilla --no-save'. Program terminated with signal 11, Segmentation fault. #0 0x7f855f6e34d1 in __strftime_internal (s=value optimized out, maxsize=256, format=value optimized out, tp=value optimized out, tzset_called=value optimized out, loc=0x7f855f9b0580) at strftime_l.c:1046 in strftime_l.c #0 0x7f855f6e34d1 in __strftime_internal (s=value optimized out, maxsize=256, format=value optimized out, tp=value optimized out, tzset_called=value optimized out, loc=0x7f855f9b0580) at strftime_l.c:1046 _n = 4 _delta = value optimized out modifier = value optimized out number_value = value optimized out subfmt = 0x7f85fffd Address 0x7f85fffd out of bounds buf = P\312\313e\377\177\000\000\364\226e\000\000\000\000\000%t2010 width = value optimized out to_lowcase = value optimized out pad = 0 digits = value optimized out negative_number = value optimized out change_case = value optimized out bufp = 0x7fff652c20e2 2010 to_uppcase = 0 current = 0x7f855f9ae020 hour12 = 12 zone = 0x0 i = 0 p = 0x7fff65cbcac0 2010-06 f = 0x7fff652c2151 G-%V #1 0x7f855f6e3db6 in *__GI___strftime_l (s=0x7fff65cbcac0 2010-06, maxsize=140734890778850, format=0x4 Address 0x4 out of bounds, tp=0x7fff652c20e2, loc=value optimized out) at strftime_l.c:490 tzset_called = false #2 0x0052677f in do_formatPOSIXlt (call=value optimized out, op=value optimized out, args=value optimized out, env=value optimized out) at datetime.c:809 q = 0x33a7420 %G-%V secs = 0 fsecs = value optimized out x = 0x2cd3bd0 sformat = 0x3394328 ans = 0x148bd230 tz = 0x33a7788 i = value optimized out n = value optimized out N = 3599546 nlen = {3599546, 3599546, 3599546, 3599546, 3599546, 3599546, 3599546, 3599546, 3599546} UseTZ = 0 buff = 2010-06, '\000' repeats 17 times\270, \245:\003\000\000\000\000\377\377\377\377\000\000\000\000\350\316\313e\377\177\000\000\202\231a, '\000' repeats 13 times, \002\000\000\000\000\000\000\000`Ø_\205\177\000\000\002\000\000\000\000\000\000\000t\313\313e\377\177\000\000p\313\313e\377\177\000\000\000\000\000\000\000\000\000\000\024\000\000\000\002\000\000\000\000\016\271^\301\277u\372p\313\313e\377\177\000\000\270\245:\003\000\000\000\000\060\315\313e\377\177, '\000' repeats 18 times\270, \245:\003\000\000\000\000\270\245:\003\000\000\000\000\230~H\000\000\000\000\000Ц:\003\000\000\000\000P\235:\003, '\000' repeats 12 times, Ц:\003\000\000\000\000\003\000\000\000\000\000\000\000\230U:\003\000\000\000\000P\235:\003\000\000\000\000\200T:\003\000\000\000\000Ð:\003\000\000\000\000\230... p = value optimized out tm = {tm_sec = 0, tm_min = 0, tm_hour = 0, tm_mday = 13, tm_mon = 1, tm_year = 110, tm_wday = 6, tm_yday = 43, tm_isdst = 0, tm_gmtoff = 0, tm_zone = 0x0} #3 0x00429f93 in do_internal (call=value optimized out, op=value optimized out, args=0x33a8d98, env=0x33a9d50) at names.c:1185 s = 0x33a54f0 fun = 0x2178e50 ans = value optimized out save = 45 flag = value optimized out vmax = 0x0 #4 0x0055c7b9 in Rf_eval (e=0x33a5480, rho=0x33a9d50) at eval.c:464 save = 44 flag = 2 vmax = 0x0 op = 0x2157fc0 tmp = value optimized out evalcount = 508 srcrefsave = 0x213a608 depthsave = 8 #5 0x0055ed3c in do_begin (call=0x33aa778, op=0x2157870, args=0x33a5448, rho=0x33a9d50) at eval.c:1245 srcrefs = 0x213a608 i = 1 s = 0x213a608 #6 0x0055c7b9 in Rf_eval (e=0x33aa778, rho=0x33a9d50) at eval.c:464 save = 42 flag = 2 vmax = 0x0 op = 0x2157870 tmp = value optimized out evalcount = 508 srcrefsave = 0x213a608 depthsave = 7 #7 0x00560560 in Rf_applyClosure (call=value optimized out, op=value optimized out, arglist=0x33a4e10, rho=value optimized out, suppliedenv=0x33a9d18) at eval.c:699 body = 0x33aa778 formals = value optimized out actuals = 0x33a9d18 savedrho = 0x213a608 newrho = 0x33a9d50 f = value optimized out a = 0x213a608
[R] as.environment Error
Dear R community, I have a problem with assign: snip for ( iii in 1:dim(ref_df)[2] ) { ret - ref_df[,iii][names(single_string[ii])]*(single_count/sum(ref_df[,iii])) assign(paste(expected_sing_ref,iii,sep=),c(get(paste(expected_single_ref,iii,sep=))), ret) } snap The Error: Error in as.environment(pos) : invalid argument Has anybody an idea, how to solve this error ? Thanks in advance, Georg __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] tis: cannot alter subset when input matrix contains NAs
When using the tis time series package (v1.9), I cannot select or alter a subset of a time series when the time series is created from a matrix and the matrix contains NA values. Example: x-tis(t(c(1:10,NA)), start=c(2000,1), freq=12) x[x0]-0 The second line yields Error in if (any(i nrow(x))) { : missing value where TRUE/FALSE needed However, both of the following work fine: x-tis(t(c(1:10)), start=c(2000,1), freq=12) # Does not contain NA x[x0]-0 x-tis(c(1:10,NA), start=c(2000,1), freq=12) # Contains NA, but input is not a matrix x[x0]-0 Can someone suggest a solution? Is this a bug? Thanks. Abiel This communication is for informational purposes only. I...{{dropped:30}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R package compilation in windows
dear R user, I al rying to compile an R package with some C code. everithing work fine as long as I work in Linux or MaCOX. unluckyly I can cant compile it under Windows, here is the error, but I cant figure it out what is the problem. can you help me? * using log directory 'C://MyPKG.Rcheck' * using ARGUMENT ' ' __ignored__ R version 2.11.0 (2010-04-22) * using session ARGUMENT ' ' __ignored__ charset: ISO8859-1 * checking for file 'MyPKG/DESCRIPTION' ... OK * this is package 'MyPKG' version '0.9' * checking package dependencies ... ERROR During startup - Warning messages: 1: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, : there is no package called 'NULL ' 2: package NULL in options(defaultPackages) was not found See the information on DESCRIPTION files in the chapter 'Creating R packages' of the 'Writing R Extensions' manual. -- John [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how is xerror calculated in rpart?
* On Thu 05:53PM -0700, 29 Apr 2010, Seth (sjmy...@syr.edu) wrote: Hi, I've searched online, in a few books, and in the archives, but haven't seen this. I believe that xerror is scaled to rel error on the first split. After fitting an rpart object, is it possible with a little math to determine the percentage of true classifications represented by a xerror value? -seth xerror is computed using a 10-fold cross-validation (see help(rpart.control)). If your misclassification costs are uniform, an xerror value of 0.9 means that the misclassification rate is 0.9 times the misclassification rate of the trivial tree with no splits. It should be easy to calculate the rate of the trivial tree, because it assigns all cases to the same class -- the class that minimizes the rate. In general, xerror is computed from the misclassification *risk*, which takes into account the loss matrix. This paper goes into some detail about rpart: @Article{ therneau.atkinson97, author= {Therneau, T.M. and Atkinson, E.J.}, title = {An Introduction to Recursive Partitioning Using the {RPART} Routines}, journal = {Mayo Clinic Technical Reports}, year = {1997}, url = {http://mayoresearch.mayo.edu/mayo/research/biostat/upload/61.pdf} } -- Best, Hsiu-Khuern. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] deriving mean from specific cases
Hi all, I have a large dataset that has 10k entries. The dataset is stored in a dataframe with the headers: SubID Condition1 Condition2 Result1 Result2 There are multiple entries for a given SubID(Subject ID). Condition 1 has 3 levels and condition2 has 2 levels (therefore there are 6 possible combinations all together e.g. Cond1 Level1 x Cond2 Level 1 etc.) and i need to compute for 1. The mean for a subject of result1 and 2 for all the permutations of condition 1 and 2. 2. The mean of all subjects for result1 and 2 split into the permutations of condition 1 and 2. can anyone advise on how this can be accomplished in R? Some data reorganisation probably needs to be done. Thanks and by the way, this is my first foray into R and I have been a long time Excel user. Appreciate any guidance! Regards, RJ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Lattice Groups
On Thu, Apr 29, 2010 at 6:15 PM, Santosh santosh2...@gmail.com wrote: Richard, Thanks for your email. I am not looking for that kind of plot as you had suggested. I would like to see overlaid boxplots. Deepayan had earlier shown the method of overlay of boxplots (using panel.groups=panel.bwplot)... I have seen in some packages like ggplot2, where the overlapped plots are automatically shown as a mix of overlapping colors, and was wondering if similar features can be implemented in lattice package... As you have figured out, the trick is to change the default settings within the panel.groups function (this is because certain parameters in panel.bwplot are taken from the settings and cannot be overridden using function arguments). Here is a cleaner implementation of that idea: my.settings - list(box.dot = list(col = c(red, blue), pch = 16), box.rectangle = list(col = c(red, blue), fill = c(pink, lightblue), alpha = c(0.5, 0.5)), box.umbrella = list(col = c(red, blue))) bwplot(y ~ factor(category), groups = level, data = tmp, panel = panel.superpose, panel.groups = function(x, y, group.number, ..., horizontal) { opar - trellis.par.get() on.exit(trellis.par.set(opar)) trellis.par.set(list(box.dot = Rows(my.settings$box.dot, group.number), box.rectangle = Rows(my.settings$box.rectangle, group.number), box.umbrella = Rows(my.settings$box.umbrella, group.number))) panel.bwplot(x, y, varwidth = TRUE, notch = TRUE, horizontal = horizontal) panel.loess(x, y, lwd = 2, alpha=0.2, lty=1, col.line = c(red,blue)[group.number]) panel.abline(h=0, col=black, lty=2) }) -Deepayan **Reproducing the earlier posted code for convenience..** tmp - data.frame( y=rnorm(100), category=rep(factor(letters[1: 5]),each=20), level=rep(factor(0:1), length=100)) barchart(y~factor(category), groups=level, data=tmp,jitter.x=F, panel=function(...){ panel.superpose( ...) panel.superpose(panel.groups=panel.bwplot, alpha=c(0.5,0.5), varwidth=T,notch=T, col=c(red,blue), fill=c(pink,lightblue),pch=16, par.settings=list(box.umbrella=list(col=c(red,blue),box.dot=list(col=c(red,blue,...) panel.superpose(panel.groups=panel.loess,lwd=2,col.line=c(red,blue),alpha=0.2,lty=1,...) panel.abline(h=0,col=black,lty=2)}, xlab=time bin (week), auto.key=list(space=right,text=c(A,H),points=T)) Thanks, Santosh On Thu, Apr 29, 2010 at 1:58 PM, RICHARD M. HEIBERGER r...@temple.edu wrote: Santosh, continuing with your example, I recommend several functions in the HH package. ## install.packages(HH) ## needed once, if you don't already have it require(HH) tmp - data.frame(y=rnorm(100), category=rep(factor(letters[1:5]), each=20), level=rep(factor(0:1), length=100)) bwplot(y ~ interaction(level, category), data=tmp, col=c(red,blue), panel=panel.bwplot.intermediate.hh) tmp$lv - with(tmp, interaction(level, category)) position(tmp$lv) - outer(c(-.3,.3), seq(1.5, 9.5, 2), `+`) bwplot(y ~ lv, data=tmp, col=c(red,blue), panel=panel.bwplot.intermediate.hh, scales=list(x=list(at=seq(1.5, 9.5, 2), labels=letters[1:5]))) Rich __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with format(,%G-%V) - Segfault
On 30/04/2010 1:17 PM, Matthias Rieber wrote: Hi, I've some problems with the new R version converting date to year-week: R version 2.11.0 (2010-04-22) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 load(test.data.R) str(test.data) Class 'Date' num [1:3599546] 13888 14166 14188 14189 14189 ... result - format(test.data, format=%G-%V) Error: segfault from C stack overflow this happens with a self compiled R version and the debian packages. The same operation works with R 2.9.x and R 2.10.x Have you tried R-patched? This looks something like PR#14267 (https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=14267) which has been fixed there. Duncan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] tis: cannot alter subset when input matrix contains NAs
Here is a workaround: for(i in 1:nrow(x)) x[i, x[i, ] 0] - 0 On Fri, Apr 30, 2010 at 11:10 AM, Abiel X Reinhart abiel.x.reinh...@jpmchase.com wrote: When using the tis time series package (v1.9), I cannot select or alter a subset of a time series when the time series is created from a matrix and the matrix contains NA values. Example: x-tis(t(c(1:10,NA)), start=c(2000,1), freq=12) x[x0]-0 The second line yields Error in if (any(i nrow(x))) { : missing value where TRUE/FALSE needed However, both of the following work fine: x-tis(t(c(1:10)), start=c(2000,1), freq=12) # Does not contain NA x[x0]-0 x-tis(c(1:10,NA), start=c(2000,1), freq=12) # Contains NA, but input is not a matrix x[x0]-0 Can someone suggest a solution? Is this a bug? Thanks. Abiel This communication is for informational purposes only. I...{{dropped:30}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Is it possible to transform a factor to a number like this way?
This is a Frequently Asked Question, so frequently in fact that it is found in the FAQ along with a couple of answers and discussion of their merits. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of song song Sent: Thursday, April 29, 2010 3:06 PM To: r-help@r-project.org Subject: [R] Is it possible to transform a factor to a number like this way? such a factor as a=as.factor(c(1.23, 4.56, 7.89)) and I want to get this vector: c(1.23, 4.56, 7.89). Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Upgrade process for libraries: can I use installed.packages on an old installation followed by install.packages in a new one
There exists a set of batchfiles for windows (they have been mentioned several times on this list before, searching the archives should give you their location) that will move or copy the installed packages from the folder for an old R installation to the folder for your new installation without overwriting the packages already present in the new installation. You can then use update.packages (with the checkbuilt or similar argument set to TRUE) in the new installation to make sure that you have compatible versions of the packages. This is probably the easiest/fastest solution for windows. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Ted Byers Sent: Thursday, April 29, 2010 2:52 PM To: R-help Forum Subject: [R] Upgrade process for libraries: can I use installed.packages on an old installation followed by install.packages in a new one I tend to have a lot of packages installed, in part because of a wide diversity of interests and a disposition of examining different ways to accomplish a given task. I am looking for a better way to upgrade all my packages when I upgrade the version of R that I am running. On looking at support for installing and updating packages, I found these two: installed.packages() and install.packages() and it occurred to me that in principle I ought to be able to use the one in the original installation to get a list of packages I'm working with and and put its output into a plain text file that I can read in the new installation and pass to the other to ensure the new installation has a fresh installation of all the packages I want to work with. The question comes WRT the fact the output from installed.packages() does not coincide with the expected input for install.packages(). What would you recommend I do to select from the output from the former so the file I write that output to will have the information the latter wants for input? For example, will it work properly if I just write the package names installed.packages() returns to the file and ignore all the rest? It is not clear to me how I'd have it ignore those packages that are part of the core of R (or even if I need to worry about that - I did see some packages listed in the output from installed.packages() that are identified as being part of R 2.10.1, when I looked at using this procedure to set up R 2.11.0). NB: I am not suggesting the output from the one should coincide with the expected input for the other. Rather, I am asking advice on writing simple R scripts that I can run in the one to get a file that would be suitable input for the other that would together make a fresh installation of a new version automatically make a fresh installation of all the previously installed packages. Thanks Ted PS: I am using Windows XP, if that matters. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] ggplot2 legend how?
Hello, I have just ordered the ggplot2: Elegant Graphics for Data Analysis (Use R) but while it arrives :) can anyone please show me how to setup and add a simple legend to a ggplot? This is my use case, I need a legend showing CI Classic, Own bootstrap, R bootstrap: library(ggplot2) e - 1 p - 1 x - 1:S y - rep(betas[p],S) data - data.frame(x,y) classiclimits - aes(x=x,ymax = classic[,e,p,1], ymin=classic[,e,p,2]) ownlimits - aes(x=x+0.4,ymax = own[,e,p,1], ymin=own[,e,p,2]) rbootlimits - aes(x=x+0.8,ymax = rboot[,e,p,1], ymin=rboot[,e,p,2]) g1 - ggplot(data, aes(x, y)) g1 + geom_errorbar(classiclimits, colour = red) + geom_errorbar(ownlimits, colour = green) + geom_errorbar(rbootlimits, colour = blue) + geom_hline(yintercept = betas[p]) + xlab(Simulation) + ylab(beta_1) + opts(title = CI for error 'normal' and beta_1) + opts(legend.position = c(10,2.5)) Many thanks in advance, Best regards, Giovanni [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R package compilation in windows
It works fine for us, hence you need to tell us where you have not followed the manual R Installation and Administration step by step. It is also helpful to see how you called CHECK and id your package installs at all. Uwe Ligges On 30.04.2010 17:53, John Lande wrote: dear R user, I al rying to compile an R package with some C code. everithing work fine as long as I work in Linux or MaCOX. unluckyly I can cant compile it under Windows, here is the error, but I cant figure it out what is the problem. can you help me? * using log directory 'C://MyPKG.Rcheck' * using ARGUMENT ' ' __ignored__ R version 2.11.0 (2010-04-22) * using session ARGUMENT ' ' __ignored__ charset: ISO8859-1 * checking for file 'MyPKG/DESCRIPTION' ... OK * this is package 'MyPKG' version '0.9' * checking package dependencies ... ERROR During startup - Warning messages: 1: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, : there is no package called 'NULL ' 2: package NULL in options(defaultPackages) was not found See the information on DESCRIPTION files in the chapter 'Creating R packages' of the 'Writing R Extensions' manual. -- John [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] deriving mean from specific cases
I would recommend the following : a) create new factor variables out of the original factor variables (Condition_1, Condition_2, ..., Condition_n) to reflect the analyses that you want to do. The builtin function interaction will do this for any number of factors b) use the summary function from package Hmisc to automatically create the descriptive statistics for each level of the newly created factors. This function will create latex versions of the table, customize presentation (e.g. number of digits) and even run statistical comparisons depending on the type of outcome variable specified. It can also create TeX versions of these tables which can be imported (e.g. through htlatex) to MSWord and OpenOffice. Cheers, Christos Argyropoulos From: rui...@gmail.com Date: Sat, 1 May 2010 01:04:19 +0800 To: r-help@r-project.org Subject: [R] deriving mean from specific cases Hi all, I have a large dataset that has 10k entries. The dataset is stored in a dataframe with the headers: SubID Condition1 Condition2 Result1 Result2 There are multiple entries for a given SubID(Subject ID). Condition 1 has 3 levels and condition2 has 2 levels (therefore there are 6 possible combinations all together e.g. Cond1 Level1 x Cond2 Level 1 etc.) and i need to compute for 1. The mean for a subject of result1 and 2 for all the permutations of condition 1 and 2. 2. The mean of all subjects for result1 and 2 split into the permutations of condition 1 and 2. can anyone advise on how this can be accomplished in R? Some data reorganisation probably needs to be done. Thanks and by the way, this is my first foray into R and I have been a long time Excel user. Appreciate any guidance! Regards, RJ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. _ Hotmail: Free, trusted and rich email service. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.