Re: [R] bootstrapping
In non-parametric bootstrapping, you do draw a sample of the same size as the original. So D - as.vector(WorldPhones[,1]) sample(D, replace=TRUE) [1] 45939 64721 60423 79831 71799 45939 76036 sample(D, replace=TRUE) [1] 45939 68484 79831 68484 76036 71799 79831 are two different bootstrap resamples. The problem in the original code is that it is trying to replace 1 value by a sample. Removing extraneous bracketing, it was boot = numeric(200) for (i in 1:200) boot [i] = sample(D,replace=T) There were 50 or more warnings (use warnings() to see the first 50) and those warnings are warnings() Warning messages: 1: number of items to replace is not a multiple of replacement length *and* the values returned are not all the same (as claimed). To return a set of bootstrap resamples you need something like boot - matrix(0,200,length(D)) for (i in 1:200) boot [i,] - sample(D, replace=TRUE) or you might intend to save the resampled statistic and not the sample itself. On Wed, 7 Jun 2006, Clément Viel wrote: 2006/6/7, Recep Aykaya [EMAIL PROTECTED]: hi. i'm a statistics student and studying bootstrap in R. i'm trying to draw bootstrap samples from a sample, using the following R code: *boot = numeric(200)* * {for (i in 1:200)* * boot [i] = (sample(data,replace=T))}* i obtain 200 samples but all of them are the same. i want to obtain different samples. what should i do? can you please help me if possible. thank you. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Hi, I think you have forgotten an parameter of the sample function. Indeed the help page give these information: sample(x, size, replace = FALSE, prob = NULL) size: non-negative integer giving the number of items to choose By default 'size' is equal to 'length(x)' so that 'sample(x)' generates a random permutation of the elements of 'x' (or '1:x'). Therefore try to add the number of observed values with this: nb=100 #the number of values for each sample boot = c() for (i in 1:200) boot [i] = mean(sample(x=data,size=nb,replace=TRUE)) # if you try to estimate the mean -- Brian D. Ripley, [EMAIL PROTECTED] 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how to analyze the following data?--anxious for the result
Asserting `y isn't noramal' only eliminates one possibility. Is it binary, a count, long-tailed, short-tailed, ...? This is really a statistical consulting problem (and apparently about SAS): see the R posting guide for where to seek advice on such problems. As the guide says, had we had sufficient information we might have been able to help, but as you need to ask again, please do so in a more appropriate place. On Thu, 8 Jun 2006, zhijie zhang wrote: Dear friends, I have a dataset: response var--y, class var-group, and the third variable-x. I want to test whether there is statistical significance bewteen group for y with the controlled x. First, i want to use analysis of covariance in SAS, but i found that y isn't noramal and can't become normal through transformation. Under that condition, what should i do using R / SAS? Any suggestions are great appreciate! -- Brian D. Ripley, [EMAIL PROTECTED] 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] help with combination problem
hi Srinivas I'm not sure I understand: your example result has 10-9 for mu1 but 1 for mu2, which is not equal to 11-9. I will assume you just got the numbers wrong. (Also J100 should be J1, no?) I am also wondering why you want what you say. It doesn't seem very sensible to mix the results from two data frames like this. The simplest thing is probably to do the two data frames separately, then intermix the rows. You can do this with for loops: for (col1 in paste(T, 1:14, sep=)) { for (col2 in paste(N, 1:16, sep=)) result[[paste(col1, -, col2, sep=)]] = df1[[col1]] - df1[[col2]] } Now repeat for data frame 2 with another data frame, e.g. result2 Then intermix the rows from result and result2. I'll leave you to figure that bit out. David On 07/06/06, Srinivas Iyyer [EMAIL PROTECTED] wrote: hello: I have 3 data.frame objects. First df object: Of dim (149,31). Columns 2:31 are marked as T1..T14 and N1..N16. Name T1T2N1 T3 N2 N3 N4 T4 mu1 1010910 9 9 8 10 mu2 1111911 9 9 9 11 ... muN 1212911 9 9 8 12 Second df object: of Dim (5,31). Columns 2:31 are maked as T1...T14 and N1..N16. Name T1T2N1 T3 N2 N3 N4 T4 J1 2 3 20 222 21 29 3 J2 4 1 20 320 21 22 4 J3 3 1 33 131 31 33 3 ... JX 3 2 20 221 22 24 2 The column samples are identical in both first and second data frames. Third df object: of Dim (200,2). V1 V2 mu1:J1 -11 mu1:J100 -10.4 mu2:J31 11.3 mu2:J2 10.4 . . muN:JX 34.5 I want to create a combination of Ts and Ns. Where I want to subtract value of T-N in all combinations(225 combinations). Such as T1-N1,T1-N2,T1-N3,T1-N4,T1-N5...T14-N16 The rows should be the row pairs from 3rd dataframe. The final resultant matrix should look like the following: T1-N1 T1-N2 T1-N3 T1-N4 T1-N5...T14-N16 mu1 1(10-9) 1(10-9) 12 11 J100 -18(2-20) -20 -19 -27-20 -29 mu2 1 32 2 11 J2 -19 -21 -39-31-31 -28 I am a beginner level in R. I apologise for asking such a big question and subsequent help. I am unable to go forward as I have no idea as to how to do this. Could any one please help me. Thanks sri __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] help with combination problem
Hi or you could try an approach of splitting original data frames and using for cycle df-matrix(sample(1:15), 3,5) df-data.frame(df) names(df) names(df)[c(1,3,4)]-c(Y1,Y2,Y3) df Y1 X2 Y2 Y3 X5 1 10 15 8 3 7 2 13 6 12 2 1 3 11 5 9 4 14 df1-df[,grep(Y,names(df))] df1 Y1 Y2 Y3 1 10 8 3 2 13 12 2 3 11 9 4 df2-df[,-grep(Y,names(df))] df2 X2 X5 1 15 7 2 6 1 3 5 14 for(i in 1:3) print(df1[,i]-df2) X2 X5 1 -5 3 2 7 12 3 6 -3 X2 X5 1 -7 1 2 6 11 3 4 -5 X2 X5 1 -12 -4 2 -4 1 3 -1 -10 and merge resulting data frames together preferably in the cycle. HTH Petr On 8 Jun 2006 at 7:50, David Hugh-Jones wrote: Date sent: Thu, 8 Jun 2006 07:50:19 +0100 From: David Hugh-Jones [EMAIL PROTECTED] To: Srinivas Iyyer [EMAIL PROTECTED] Copies to: r-help@stat.math.ethz.ch Subject:Re: [R] help with combination problem hi Srinivas I'm not sure I understand: your example result has 10-9 for mu1 but 1 for mu2, which is not equal to 11-9. I will assume you just got the numbers wrong. (Also J100 should be J1, no?) I am also wondering why you want what you say. It doesn't seem very sensible to mix the results from two data frames like this. The simplest thing is probably to do the two data frames separately, then intermix the rows. You can do this with for loops: for (col1 in paste(T, 1:14, sep=)) { for (col2 in paste(N, 1:16, sep=)) result[[paste(col1, -, col2, sep=)]] = df1[[col1]] - df1[[col2]] } Now repeat for data frame 2 with another data frame, e.g. result2 Then intermix the rows from result and result2. I'll leave you to figure that bit out. David On 07/06/06, Srinivas Iyyer [EMAIL PROTECTED] wrote: hello: I have 3 data.frame objects. First df object: Of dim (149,31). Columns 2:31 are marked as T1..T14 and N1..N16. Name T1T2N1 T3 N2 N3 N4 T4 mu1 1010910 9 9 8 10 mu2 1111911 9 9 9 11 ... muN 1212911 9 9 8 12 Second df object: of Dim (5,31). Columns 2:31 are maked as T1...T14 and N1..N16. Name T1T2N1 T3 N2 N3 N4 T4 J1 2 3 20 222 21 29 3 J2 4 1 20 320 21 22 4 J3 3 1 33 131 31 33 3 ... JX 3 2 20 221 22 24 2 The column samples are identical in both first and second data frames. Third df object: of Dim (200,2). V1 V2 mu1:J1 -11 mu1:J100 -10.4 mu2:J31 11.3 mu2:J2 10.4 . . muN:JX 34.5 I want to create a combination of Ts and Ns. Where I want to subtract value of T-N in all combinations(225 combinations). Such as T1-N1,T1-N2,T1-N3,T1-N4,T1-N5...T14-N16 The rows should be the row pairs from 3rd dataframe. The final resultant matrix should look like the following: T1-N1 T1-N2 T1-N3 T1-N4 T1-N5...T14-N16 mu1 1(10-9) 1(10-9) 12 11 J100 -18(2-20) -20 -19 -27-20 -29 mu2 1 32 2 11 J2 -19 -21 -39-31-31 -28 I am a beginner level in R. I apologise for asking such a big question and subsequent help. I am unable to go forward as I have no idea as to how to do this. Could any one please help me. Thanks sri __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] expand only one of variable
Dear all, I want to expand only one of variable in data frame and the others variable will be following with the expand variable. Here my toy example: toy.df - data.frame(size=c(3,1,2,0,3,5,1,0), group=LETTERS[1:8], country=c(Germany,England,Argentina,Mexico,Italy,Brazil,France,Spain), w=rep(0,8), d=rep(0,8), l=rep(0,8)) toy.df The size variable is the number of expand and signed by positive but size with 0 (zero) must be signed by negative. The result something like: size group country w d l sign 3 A Germany 0 0 0 positive 3 A Germany 0 0 0 positive 3 A Germany 0 0 0 positive 1 B England 0 0 0 positive 2 C Argentina 0 0 0 positive 2 C Argentina 0 0 0 positive 0 DMexico 0 0 0 negative 3 E Italy 0 0 0 positive 3 E Italy 0 0 0 positive 3 E Italy 0 0 0 positive 5 FBrazil 0 0 0 positive 5 FBrazil 0 0 0 positive 5 FBrazil 0 0 0 positive 5 FBrazil 0 0 0 positive 5 FBrazil 0 0 0 positive 1 GFrance 0 0 0 positive 0 H Spain 0 0 0 negative I would be very happy if anyone could help me. Thank you very much in advance. Kindly regards, Muhammad Subianto __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] expand only one of variable
toy.df$sign - ifelse(toy.df$size == 0, negative, positive) toy.df[rep(1:nrow(toy.df), ifelse(toy.df$size==0, 1, toy.df$size)),] --- Jacques VESLOT CNRS UMR 8090 I.B.L (2ème étage) 1 rue du Professeur Calmette B.P. 245 59019 Lille Cedex Tel : 33 (0)3.20.87.10.44 Fax : 33 (0)3.20.87.10.31 http://www-good.ibl.fr --- Muhammad Subianto a écrit : Dear all, I want to expand only one of variable in data frame and the others variable will be following with the expand variable. Here my toy example: toy.df - data.frame(size=c(3,1,2,0,3,5,1,0), group=LETTERS[1:8], country=c(Germany,England,Argentina,Mexico,Italy,Brazil,France,Spain), w=rep(0,8), d=rep(0,8), l=rep(0,8)) toy.df The size variable is the number of expand and signed by positive but size with 0 (zero) must be signed by negative. The result something like: size group country w d l sign 3 A Germany 0 0 0 positive 3 A Germany 0 0 0 positive 3 A Germany 0 0 0 positive 1 B England 0 0 0 positive 2 C Argentina 0 0 0 positive 2 C Argentina 0 0 0 positive 0 DMexico 0 0 0 negative 3 E Italy 0 0 0 positive 3 E Italy 0 0 0 positive 3 E Italy 0 0 0 positive 5 FBrazil 0 0 0 positive 5 FBrazil 0 0 0 positive 5 FBrazil 0 0 0 positive 5 FBrazil 0 0 0 positive 5 FBrazil 0 0 0 positive 1 GFrance 0 0 0 positive 0 H Spain 0 0 0 negative I would be very happy if anyone could help me. Thank you very much in advance. Kindly regards, Muhammad Subianto __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] panel.abline and xyplot
Dear All, I am wondering on how to use the abline.xyplot with xyplot such that I will have different vertical lines for each panel. More sepcifically, suppose that the xyplot generates 4 panels defined by the combination of two binary variables: X_1 and X_2. i.e. xyplot(Y ~ Z | X_1*X_2, data = df) I want something like: abline(v = 5) if X_1=0 and X_2 = 0 abline(v = 10) if X_1=0 and X_2 = 1 abline(v = 15) if X_1=1 and X_2 = 0 abline(v = 31) if X_1=1 and X_2 = 1 when I used : xyplot(Y ~ Z | X_1*X_2, data=df, panel = function(x,y) {panel.xyplot(x,y) panel.abline(v=70)}) it produces the same vertical line in the four panels. Thanks a lot, Bernard __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Re-binning histogram data
Hi, Short Version: Is there a function to re-bin a histogram to new, broader bins? Long version: I'm trying to create a histogram, however my input-data is itself in the form of a fine-grained histogram, i.e. numbers of counts in regular one-second bins. I want to produce a histogram of, say, 10-minute bins (though possibly irregular bins also). I suppose I could re-create a data set as expected by the hist() function (i.e. if time t=3600 has 6 counts, add six entries of 3600 to a list) however this seems neither elegant nor efficient (though I'd be pleased to be mistaken!). I could then re-create a histogram as normal. I guessing there's a better solution however! Apologies if this is a basic question - I'm rather new to R and trying to get up to speed. Regards, Justin __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Re-binning histogram data
Hi try truehist from MASS package and look for argument breaks or h. HTH Petr On 8 Jun 2006 at 10:46, Justin Ashmall wrote: Date sent: Thu, 8 Jun 2006 10:46:19 +0100 (BST) From: Justin Ashmall [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject:[R] Re-binning histogram data Hi, Short Version: Is there a function to re-bin a histogram to new, broader bins? Long version: I'm trying to create a histogram, however my input-data is itself in the form of a fine-grained histogram, i.e. numbers of counts in regular one-second bins. I want to produce a histogram of, say, 10-minute bins (though possibly irregular bins also). I suppose I could re-create a data set as expected by the hist() function (i.e. if time t=3600 has 6 counts, add six entries of 3600 to a list) however this seems neither elegant nor efficient (though I'd be pleased to be mistaken!). I could then re-create a histogram as normal. I guessing there's a better solution however! Apologies if this is a basic question - I'm rather new to R and trying to get up to speed. Regards, Justin __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Plotting female and male signs
Dear R-users, Just like other users (as seen from previous posts on the list), I would like to use female and male signs in plots. I found B. Ripley's post about using Unicode characters. However, it doesn't works for me. text(locator(1),\u2640) produces the following error: Error: invalid \u sequence But I can specify other Unicode characters as long I don't exceed 00FF, so this works text(locator(1),\u00FF) or text(locator(1),\u00E6) and also without preceeding 00 text(locator(1),\uE6) Can someone give me a hint? I'm using a Swedish locale on WindowsXP and my R version is 2.3.1 Patched (2006-06-04 r38279) Thanks, Hans Gardfjell -- * Hans Gardfjell Ecology and Environmental Science Umeå University 90187 Umeå, Sweden email: hans.gardfjell at emg.umu.se phone: +46 907865267 mobile: +46 705984464 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Re-binning histogram data
Thanks for the reply Petr, It looks to me that truehist() needs a vector of data just like hist()? Whereas I have histogram-style input data? Am I missing something? Cheers, Justin On Thu, 8 Jun 2006, Petr Pikal wrote: Hi try truehist from MASS package and look for argument breaks or h. HTH Petr On 8 Jun 2006 at 10:46, Justin Ashmall wrote: Date sent:Thu, 8 Jun 2006 10:46:19 +0100 (BST) From: Justin Ashmall [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject: [R] Re-binning histogram data Hi, Short Version: Is there a function to re-bin a histogram to new, broader bins? Long version: I'm trying to create a histogram, however my input-data is itself in the form of a fine-grained histogram, i.e. numbers of counts in regular one-second bins. I want to produce a histogram of, say, 10-minute bins (though possibly irregular bins also). I suppose I could re-create a data set as expected by the hist() function (i.e. if time t=3600 has 6 counts, add six entries of 3600 to a list) however this seems neither elegant nor efficient (though I'd be pleased to be mistaken!). I could then re-create a histogram as normal. I guessing there's a better solution however! Apologies if this is a basic question - I'm rather new to R and trying to get up to speed. Regards, Justin __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Plotting female and male signs
On Thu, 8 Jun 2006, Hans Gardfjell wrote: Dear R-users, Just like other users (as seen from previous posts on the list), I would like to use female and male signs in plots. I found B. Ripley's post about using Unicode characters. However, it doesn't works for me. text(locator(1),\u2640) produces the following error: Error: invalid \u sequence But I can specify other Unicode characters as long I don't exceed 00FF, so this works text(locator(1),\u00FF) or text(locator(1),\u00E6) and also without preceeding 00 text(locator(1),\uE6) Can someone give me a hint? I'm using a Swedish locale on WindowsXP and my R version is 2.3.1 Patched (2006-06-04 r38279) Hans, R edit(vignette(Ch_logistic_regression_glm, package = HSAUR)) (you need to install package `HSAUR') has an example, specifically the line text(womensrole$education, y, ifelse(f, \\VE, \\MA), vfont = c(serif, plain), cex = 1.25) uses Hershey fonts, see ?Hershey Torsten Thanks, Hans Gardfjell -- * Hans Gardfjell Ecology and Environmental Science Ume? University 90187 Ume?, Sweden email: hans.gardfjell at emg.umu.se phone: +46 907865267 mobile: +46 705984464 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] panel.abline and xyplot
Marc Bernard bernarduse1 at yahoo.fr writes: I am wondering on how to use the abline.xyplot with xyplot such that I will have different vertical lines for each panel. More sepcifically, suppose that the xyplot generates 4 panels defined by the combination of two binary variables: X_1 and X_2. i.e. xyplot(Y ~ Z | X_1*X_2, data = df) abline(v = 5) if X_1=0 and X_2 = 0 abline(v = 10) if X_1=0 and X_2 = 1 abline(v = 15) if X_1=1 and X_2 = 0 abline(v = 31) if X_1=1 and X_2 = 1 when I used : xyplot(Y ~ Z | X_1*X_2, data=df, panel = function(x,y) {panel.xyplot(x,y) panel.abline(v=70)}) it produces the same vertical line in the four panels. I use subscripts to display separately stored array data, but I am sure there must be a more elegant of knowing what the current group is than by accessing its first element. Dieter library(lattice) quakes$Depth = as.factor(floor(quakes$depth/100)) quakes$Mag = as.factor(floor(quakes$mag)) whereline = expand.grid( Mag=levels(quakes$Mag), Depth=levels(quakes$Depth)) whereline$line = rnorm(nrow(whereline),-30,10) xyplot(lat ~ long | Depth*Mag, data = quakes, panel = function(x,y,subscripts,...) { mg = quakes[subscripts[1],] with (whereline, panel.abline(h= whereline[Mag==mg$Mag Depth==mg$Depth,line])) panel.xyplot(x,y,...) } ) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Plotting female and male signs
On Thu, 8 Jun 2006, Hans Gardfjell wrote: Dear R-users, Just like other users (as seen from previous posts on the list), I would like to use female and male signs in plots. I found B. Ripley's post about using Unicode characters. However, it doesn't works for me. text(locator(1),\u2640) produces the following error: Error: invalid \u sequence But I can specify other Unicode characters as long I don't exceed 00FF, so this works text(locator(1),\u00FF) or text(locator(1),\u00E6) and also without preceeding 00 text(locator(1),\uE6) Can someone give me a hint? I'm using a Swedish locale on WindowsXP and my R version is 2.3.1 Patched (2006-06-04 r38279) Unicode characters only work if they are valid in the locale: for these, only in UTF-8 locales (hence not on Windows). If you were referring to http://finzi.psych.upenn.edu/R/Rhelp02a/archive/63615.html it did say You don't tell us your platform and the answer depends on the platform. Alternatively, look at the Hershey fonts, which have these and many other symbols (not necessarily of publication-quality though). -- Brian D. Ripley, [EMAIL PROTECTED] 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Problems Building R-2.3.1 on Alpha server ES40 running Tru64 V5.1B PK#5
R Listers, One of the list contributors suggested I abandon attempts to build R-1.9.1 and focus on building R-2.3.1. I believe the main set of packages have been built properly (with some changes to the code) - however, when building the Recommended packages, the build fails. CODE CHANGES: = 1. My C compiler requires a ; on line 589 of /src/main/printutils.c. Here is the diff: # diff src/main/printutils.c.orig src/main/printutils.c 589c589 if (con_num0) error(Internal error: this platform does not support split output) --- if (con_num0) error(Internal error: this platform does not support split output); Build Results: == The problem seems to be in building the Recommended packages. For MASS, The actual build seems to happen in /tmp, however, the next package expects the build somewhere else. Do I have to build the Recommended packages? If not, how do I avoid it? I suspect the unresolved symbols are OK, as they will get pulled in from shared libraries. make[2]: Entering directory `/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/src/li brary/Recommended' begin installing recommended package VR * Installing *source* package 'MASS' ... ** libs make[3]: Entering directory `/cluster/members/member0/tmp/R.INSTALL.OVYGvZ/VR/MASS/src' cc -I/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/inclu de -I/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/buil d/include -I/opt/gnu/include -I/opt/libjpeg/include -I/opt/libpng/include -I/opt/zlib/include -I/opt/ncurses/include -ieee_with_inexact-st d1 -c MASS.c -o MASS.o cc -I/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/inclu de -I/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/buil d/include -I/opt/gnu/include -I/opt/libjpeg/include -I/opt/libpng/include -I/opt/zlib/include -I/opt/ncurses/include -ieee_with_inexact-st d1 -c lqs.c -o lqs.o cc -shared -L/opt/gnu/lib -L/opt/libjpeg/lib -L/opt/libpng/lib -L/opt/ncurses/lib -L/opt/zlib/lib -lncurses -ljpeg -lpng -lz -rpath /opt/libpng /lib:/opt/libjpeg/lib:/opt/ncurses/lib:/opt/gnu/lib:/usr/shlib:/opt/zlib /lib:/opt/R/lib -o MASS.so MASS.o lqs.o ld: Warning: Unresolved: exp fabs pow sqrt isnan Rf_error R_alloc Rprintf R_chk_calloc R_chk_free vmmin R_registerRoutines R_useDynamicSymbols log GetRNGstate PutRNGstate unif_rand R_rsort Rf_rPsort R_CheckUserInterrupt dqrsl_ dqrdc2_ make[3]: Leaving directory `/cluster/members/member0/tmp/R.INSTALL.OVYGvZ/VR/MASS/src' chmod: cannot access `/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/librar y/MASS/libs//*': No such file or directory ** R ** data chmod: cannot access `/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/librar y/MASS/data/*': No such file or directory ** moving datasets to lazyload DB *** caught segfault *** address 10008, cause 'memory not mapped' Traceback: 1: print.default(f0) 2: print(f0) 3: tools:::data2LazyLoadDB(MASS, /usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/librar y) aborting ... /usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/bin/INS TALL: 367631 Memory fault - core dumped ERROR: lazydata failed for package 'MASS' ** Removing '/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/librar y/MASS' ** Removing '/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/librar y/class' ** Removing '/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/librar y/nnet' ** Removing '/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/librar y/spatial' make[2]: *** [VR.ts] Error 1 make[2]: Leaving directory `/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/src/li brary/Recommended' make[1]: *** [recommended-packages] Error 2 make[1]: Leaving directory `/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/src/li brary/Recommended' make: *** [stamp-recommended] Error 2 Narendra Ravi __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] installation problems Rgraphviz
Problems: -the standard PATH is not fit to compile 64bit stuf, so unset it: unsetenv PATH -we did not have pkg-config installed, used yast to install it -we did not have these environment variables set: setenv LD_LIBRARY_PATH /geninf/prog/VIZ64/lib/graphviz setenv PKG_CONFIG_PATH /geninf/prog/VIZ64/lib/pkgconfig/ we installed graphvix 2.6 and rgraphviz 1.8 we installed in R using: source(http://bioconductor.org/getBioC.R;) getBioC(Rgraphviz) and then: library(Rgraphviz) works fine Harm Nijveen [EMAIL PROTECTED] Wageningen [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Reading in a table with ISO-latin1 encoding in MacOS-X (Intel)
Dear colleages in R, I have earlier been working with R in Linux, where reading in a table containing Scandinavian letters (ä, ö, and å) in the header as part of variable names has not caused any problem whatsoever. However, when trying to do the same in R running on new MacOS-X (with an Intel processor) with the same original text table does not seem to work whichever way I try. Following the recommendations on the R site and using the 'file' function to set the encoding breaks down at the first encounter with a Scandinavian character: THINK - read.table(file(R_data/hs+sfnet.T.060505.tbl4, encoding=latin1),header=TRUE) Warning messages: 1: invalid input found on input connection 'R_data/hs+sfnet.T.060505.tbl4' 2: incomplete final line found by readTableHeader on 'R_data/hs+sfnet.T.060505.tbl4' A sample exemplifying such characters as variable labels is below (for which the behavior of R in Mac is the same as for the larger file referred to above):. ajatella miettiä pohtia 1 FALSE FALSE TRUE 2 FALSE FALSE FALSE 3 FALSETRUE FALSE 4 FALSETRUE FALSE 5 TRUE FALSE FALSE 6 TRUE FALSE FALSE 7 FALSE FALSE FALSE 8 FALSETRUE FALSE 9 FALSETRUE FALSE 10FALSE FALSE FALSE Converting the the file from ISO-latin-1 to UTF8 (with Mac's TextEdit application)allows the file to be read in in its entirety, but still the Scandinavian character in the heading is coerced to a period '.', or two, in fact (i.e. 'miettiä' - 'miett..') Have I possibly misunderstood how the 'file' function should be used in conjunction with 'read.table', or might the problem with latin1-to-utf conversion be somewhere else? Appreciating any help on this matter, -- == Antti Arppe - Master of Science (Engineering) Researcher doctoral student (Linguistics) E-mail: [EMAIL PROTECTED] WWW: http://www.ling.helsinki.fi/~aarppe__ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Problems Building R-2.3.1 on Alpha server ES40 running Tru64 V5.1B PK#5
On Thu, 8 Jun 2006, Ravi, Narendra, INFOT wrote: R Listers, One of the list contributors suggested I abandon attempts to build R-1.9.1 and focus on building R-2.3.1. I believe the main set of packages have been built properly (with some changes to the code) - however, when building the Recommended packages, the build fails. CODE CHANGES: = 1. My C compiler requires a ; on line 589 of /src/main/printutils.c. Here is the diff: # diff src/main/printutils.c.orig src/main/printutils.c 589c589 if (con_num0) error(Internal error: this platform does not support split output) --- if (con_num0) error(Internal error: this platform does not support split output); That is already changed in R-devel and the most recent R-patched. (Some platforms which do not have va_copy required more extensive changes.) Build Results: == The problem seems to be in building the Recommended packages. For MASS, The actual build seems to happen in /tmp, however, the next package expects the build somewhere else. Do I have to build the Recommended packages? If not, how do I avoid it? I suspect the unresolved symbols are OK, as they will get pulled in from shared libraries. It looks like *warnings* are causing your linker to fail. If so, you need to change the linker flags to allow this to complete. You can configure and build without recommended packages, but likely the problem will arise when you try most additional packages. make[2]: Entering directory `/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/src/li brary/Recommended' begin installing recommended package VR * Installing *source* package 'MASS' ... ** libs make[3]: Entering directory `/cluster/members/member0/tmp/R.INSTALL.OVYGvZ/VR/MASS/src' cc -I/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/inclu de -I/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/buil d/include -I/opt/gnu/include -I/opt/libjpeg/include -I/opt/libpng/include -I/opt/zlib/include -I/opt/ncurses/include -ieee_with_inexact-st d1 -c MASS.c -o MASS.o cc -I/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/inclu de -I/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/buil d/include -I/opt/gnu/include -I/opt/libjpeg/include -I/opt/libpng/include -I/opt/zlib/include -I/opt/ncurses/include -ieee_with_inexact-st d1 -c lqs.c -o lqs.o cc -shared -L/opt/gnu/lib -L/opt/libjpeg/lib -L/opt/libpng/lib -L/opt/ncurses/lib -L/opt/zlib/lib -lncurses -ljpeg -lpng -lz -rpath /opt/libpng /lib:/opt/libjpeg/lib:/opt/ncurses/lib:/opt/gnu/lib:/usr/shlib:/opt/zlib /lib:/opt/R/lib -o MASS.so MASS.o lqs.o ld: Warning: Unresolved: exp fabs pow sqrt isnan Rf_error R_alloc Rprintf R_chk_calloc R_chk_free vmmin R_registerRoutines R_useDynamicSymbols log GetRNGstate PutRNGstate unif_rand R_rsort Rf_rPsort R_CheckUserInterrupt dqrsl_ dqrdc2_ make[3]: Leaving directory `/cluster/members/member0/tmp/R.INSTALL.OVYGvZ/VR/MASS/src' chmod: cannot access `/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/librar y/MASS/libs//*': No such file or directory ** R ** data chmod: cannot access `/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/librar y/MASS/data/*': No such file or directory ** moving datasets to lazyload DB *** caught segfault *** address 10008, cause 'memory not mapped' Traceback: 1: print.default(f0) 2: print(f0) 3: tools:::data2LazyLoadDB(MASS, /usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/librar y) aborting ... /usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/bin/INS TALL: 367631 Memory fault - core dumped ERROR: lazydata failed for package 'MASS' ** Removing '/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/librar y/MASS' ** Removing '/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/librar y/class' ** Removing '/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/librar y/nnet' ** Removing '/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/librar y/spatial' make[2]: *** [VR.ts] Error 1 make[2]: Leaving directory `/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/src/li brary/Recommended' make[1]: *** [recommended-packages] Error 2 make[1]: Leaving directory `/usr/ruby-deploy/swkits/RUBY/SOFTWARE/3rdPartySW/R/R-2.3.1/build/src/li brary/Recommended' make: *** [stamp-recommended] Error 2 Narendra Ravi __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Brian D. Ripley, [EMAIL PROTECTED] 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)
[R] JGR :: Can't Run Graphics Demo
Hello: I am using JGR 1.4, the Java GUI for R and I am trying to run the demo for graphics using the command: demo(graphics) I keep on getting the following errror: Error in get(getOption(device))() : unable to start device JavaGD FYI, the version of Java I am using is: 1.5.0_07-b03 Do I need to use a different version of Java? Does anyone have any recommendations/suggestions? Many Thanks In Advance: Alex __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Re-binning histogram data
On 8 Jun 2006 at 11:35, Justin Ashmall wrote: Date sent: Thu, 8 Jun 2006 11:35:46 +0100 (BST) From: Justin Ashmall [EMAIL PROTECTED] To: Petr Pikal [EMAIL PROTECTED] Copies to: r-help@stat.math.ethz.ch Subject:Re: [R] Re-binning histogram data Thanks for the reply Petr, It looks to me that truehist() needs a vector of data just like hist()? Whereas I have histogram-style input data? Am I missing something? Well, maybe you could use barplot. Or as you suggested recreate the original vector and call hist or truehist with other bins. hhh-hist(rnorm(1000)) barplot(tapply(hhh$counts, c(rep(1:7,each=2),7), sum)) tapply(hhh$mids, c(rep(1:7,each=2),7), mean) 1 2 3 4 5 6 7 -3.00 -2.00 -1.00 0.00 1.00 2.00 3.25 hhh1-rep(hhh$mids,hhh$counts) plot(hhh, freq=F) lines(density(hhh1)) HTH Petr Cheers, Justin On Thu, 8 Jun 2006, Petr Pikal wrote: Hi try truehist from MASS package and look for argument breaks or h. HTH Petr On 8 Jun 2006 at 10:46, Justin Ashmall wrote: Date sent: Thu, 8 Jun 2006 10:46:19 +0100 (BST) From: Justin Ashmall [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject:[R] Re-binning histogram data Hi, Short Version: Is there a function to re-bin a histogram to new, broader bins? Long version: I'm trying to create a histogram, however my input-data is itself in the form of a fine-grained histogram, i.e. numbers of counts in regular one-second bins. I want to produce a histogram of, say, 10-minute bins (though possibly irregular bins also). I suppose I could re-create a data set as expected by the hist() function (i.e. if time t=3600 has 6 counts, add six entries of 3600 to a list) however this seems neither elegant nor efficient (though I'd be pleased to be mistaken!). I could then re-create a histogram as normal. I guessing there's a better solution however! Apologies if this is a basic question - I'm rather new to R and trying to get up to speed. Regards, Justin __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Reading in a table with ISO-latin1 encoding in MacOS-X (Intel)
Le Thu, Jun 08, 2006 at 04:10:08PM +0300, Antti Arppe a écrit : Converting the the file from ISO-latin-1 to UTF8 (with Mac's TextEdit application)allows the file to be read in in its entirety, but still the Scandinavian character in the heading is coerced to a period '.', or two, in fact (i.e. 'miettiä' - 'miett..') Dear Antti, I may be wrong, but the unicode accented latin letters are not encoded the same on linux and macintosh. On linux, ä is ä, but on Macintosh, it is +a (please read the quotes as if there were an umlaut). Did you try to just retype the headers with a macintosh text editor? Good luck! -- Charles Plessy Wako, Saitama, Japan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] JGR :: Can't Run Graphics Demo
Have you installed the following packages?They are javaGD,rJava,iplots,iWidgets? It seems that you have installed the javaGD package. 2006/6/8, Alex Restrepo [EMAIL PROTECTED]: Hello: I am using JGR 1.4, the Java GUI for R and I am trying to run the demo for graphics using the command: demo(graphics) I keep on getting the following errror: Error in get(getOption(device))() : unable to start device JavaGD FYI, the version of Java I am using is: 1.5.0_07-b03 Do I need to use a different version of Java? Does anyone have any recommendations/suggestions? Many Thanks In Advance: Alex __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- 黄荣贵 Deparment of Sociology Fudan University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Rgraphviz overlap of nodes and edges
Hi, I plot graphs on small diagrams. With colored or thick edge lines then the nodes and the edges overlap. The edge line overwrites the nodes which looks ugly. What can be done about that? I already tried to change the sep attribute with no effect. Thanks, Franz Quehenberger V - letters[1:10] M - 1:4 g1 - randomGraph(V, M, .2) z - getDefaultAttrs() z$edge$color=red z$edge$weight=5 plot(g1,neato,attrs=z) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Reading in a table with ISO-latin1 encoding in MacOS-X (Intel)
Antti Arppe [EMAIL PROTECTED] writes: Converting the the file from ISO-latin-1 to UTF8 (with Mac's TextEdit application)allows the file to be read in in its entirety, but still the Scandinavian character in the heading is coerced to a period '.', or two, in fact (i.e. 'miettiä' - 'miett..') I think you probably need check.names=FALSE. (Presumably, you cannot have Finnish characters in variable names either on the Mac?) Have I possibly misunderstood how the 'file' function should be used in conjunction with 'read.table', or might the problem with latin1-to-utf conversion be somewhere else? Not really, text encodings are just a pain. The blame for this fact can be shifted in various directions, but it doesn't really help... (My personal angle is that ISO-8859 was terribly shortsighted, and stuck in a Western Europe mindset. As soon as the iron curtain disappeared and we started to deal with people from Slavic countries, the weakness was revealed.) The basic structure looks OK, and works for me on Linux: read.table(file(xx.data,encoding=latin1),header=TRUE) æh bøh 1 1 2 so one can only guess that you have a local or Mac-specific setup issue. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Reading in a table with ISO-latin1 encoding in MacOS-X (Intel)
You are using this as intended, although your email message came in latin9 not latin1, which does not affect your examples. Have you actually checked (e.g. via a hex dump) that the file is in latin1? I assume that if you converted the file to UTF-8 you then used read.table(R_data/hs+sfnet.T.060505.tbl4, header=TRUE) If so, you need to investigate the locale in use, as which letters are valid depends on the locale: on Linux UTF-8 locales all letters in all languages are valid in R names, but that is not necessarily the MacOS interpretation. (Invalid characters in names will be converted to ., and if the locale is wrong so may be the interpretation of bytes as characters.) You might find more informed help on the r-sig-mac list. On Thu, 8 Jun 2006, Antti Arppe wrote: Dear colleages in R, I have earlier been working with R in Linux, where reading in a table containing Scandinavian letters (ä, ö, and å) in the header as part of variable names has not caused any problem whatsoever. However, when trying to do the same in R running on new MacOS-X (with an Intel processor) with the same original text table does not seem to work whichever way I try. Following the recommendations on the R site and using the 'file' function to set the encoding breaks down at the first encounter with a Scandinavian character: THINK - read.table(file(R_data/hs+sfnet.T.060505.tbl4, encoding=latin1),header=TRUE) Warning messages: 1: invalid input found on input connection 'R_data/hs+sfnet.T.060505.tbl4' 2: incomplete final line found by readTableHeader on 'R_data/hs+sfnet.T.060505.tbl4' A sample exemplifying such characters as variable labels is below (for which the behavior of R in Mac is the same as for the larger file referred to above):. ajatella miettiä pohtia 1 FALSE FALSE TRUE 2 FALSE FALSE FALSE 3 FALSETRUE FALSE 4 FALSETRUE FALSE 5 TRUE FALSE FALSE 6 TRUE FALSE FALSE 7 FALSE FALSE FALSE 8 FALSETRUE FALSE 9 FALSETRUE FALSE 10FALSE FALSE FALSE Converting the the file from ISO-latin-1 to UTF8 (with Mac's TextEdit application)allows the file to be read in in its entirety, but still the Scandinavian character in the heading is coerced to a period '.', or two, in fact (i.e. 'miettiä' - 'miett..') Have I possibly misunderstood how the 'file' function should be used in conjunction with 'read.table', or might the problem with latin1-to-utf conversion be somewhere else? Appreciating any help on this matter, -- Brian D. Ripley, [EMAIL PROTECTED] 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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Rotate numbers on the Y axis on a multiple Boxplot chart
Hello All, I am trying to format a box plot chart for a report so it matches other charts I have created in other software programs. My problem is that I need to rotate the values on the Y axis by 45 degrees, I have tried to use the srt parameter but with no luck? Does anybody have any suggestions? Regards, Daniel My syntax is as follows: boxplot(int~sortf,notch=TRUE,outline=FALSE,col=DarkSeaGreen4, ylab = Length of stay in days,ylim=c(0, 100),xlab=Trust (see key)) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Example(chron) doesn't work
Under R 2.3.1 for Windows (win xp) issuing example(chron) gives: chron dts - dates(c(02/27/92, 02/27/92, 01/14/92, 02/28/92, 02/01/92)) Error in dates(c(02/27/92, 02/27/92, 01/14/92, 02/28/92, 02/01/92)) : no direct or inherited method for function 'dates' for this call dts-dates(c(02/27/92, 02/27/92, 01/14/92,02/28/92, 02/01/92),format=%m/%d/%y) Errore in dates(c(02/27/92, 02/27/92, 01/14/92, 02/28/92, 02/01/92), : no direct or inherited method for function 'dates' for this call What should I do? Thanks Vittorio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Rotate numbers on the Y axis on a multiple Boxplot chart
On Thu, 2006-06-08 at 15:44 +0100, d d [EMAIL PROTECTED] ac uk wrote: Hello All, I am trying to format a box plot chart for a report so it matches other charts I have created in other software programs. My problem is that I need to rotate the values on the Y axis by 45 degrees, I have tried to use the srt parameter but with no luck? Does anybody have any suggestions? Regards, Daniel My syntax is as follows: boxplot(int~sortf,notch=TRUE,outline=FALSE,col=DarkSeaGreen4, ylab = Length of stay in days,ylim=c(0, 100),xlab=Trust (see key)) See R FAQ 7.27 How can I create rotated axis labels? The example there is for the x axis, but the same concept applies for y. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Example(chron) doesn't work
Sorry that was XP. On 6/8/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: I can't reproduce that on 2.3.1 patched nor on 2.2.1. For me it works. On 6/8/06, Vittorio [EMAIL PROTECTED] wrote: Under R 2.3.1 for Windows (win xp) issuing example(chron) gives: chron dts - dates(c(02/27/92, 02/27/92, 01/14/92, 02/28/92, 02/01/92)) Error in dates(c(02/27/92, 02/27/92, 01/14/92, 02/28/92, 02/01/92)) : no direct or inherited method for function 'dates' for this call dts-dates(c(02/27/92, 02/27/92, 01/14/92,02/28/92, 02/01/92),format=%m/%d/%y) Errore in dates(c(02/27/92, 02/27/92, 01/14/92, 02/28/92, 02/01/92), : no direct or inherited method for function 'dates' for this call What should I do? Thanks Vittorio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Example(chron) doesn't work
I can't reproduce that on 2.3.1 patched nor on 2.2.1. For me it works. On 6/8/06, Vittorio [EMAIL PROTECTED] wrote: Under R 2.3.1 for Windows (win xp) issuing example(chron) gives: chron dts - dates(c(02/27/92, 02/27/92, 01/14/92, 02/28/92, 02/01/92)) Error in dates(c(02/27/92, 02/27/92, 01/14/92, 02/28/92, 02/01/92)) : no direct or inherited method for function 'dates' for this call dts-dates(c(02/27/92, 02/27/92, 01/14/92,02/28/92, 02/01/92),format=%m/%d/%y) Errore in dates(c(02/27/92, 02/27/92, 01/14/92, 02/28/92, 02/01/92), : no direct or inherited method for function 'dates' for this call What should I do? Thanks Vittorio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Density Estimation
On Wed, 07 Jun 2006 19:54:32 +0200, Pedro Ramirez wrote: PR Not a direct answer to your question, but if you use a logspline PR density estimate rather than a kernal density estimate then the PR logspline package will help you and it has built in functions for PR dlogspline, qlogspline, and plogspline that do the integrals for PR you. PR PR If you want to stick with the KDE, then you could find the area PR under each of the kernals for the range you are interested in PR (need to work out the standard deviation used from the bandwidth, PR then use pnorm for the default gaussian kernal), then just sum PR the individual areas. PR PR Hope this helps, PR PR Thanks a lot for your quick help! I think I will follow your first PR PR suggestion (logspline PR density estimation) instead of summing over the kernel areas PR because at the boundaries of the range truncated kernel areas can PR occur, so I think it is easier to do it with logsplines. Thanks PR again for your help!! PR PR Pedro PR PR Besides the computational aspect, there is a statistical one: the optimal choice of bandwidth for estimating the density function is not optimal (and possibly not even jsut sensible) for estimating the distribution function, and the stated problem is equivalent to estimation of the distribution function. In mathematical terms the optimal bandwith for density estimation decreases at rate n^{-1/5}, while the one for distribution function decreases at rate n^{-1/3}, if n is the sample size. In practical terms, one must choose an appreciably smaller bandwidth in the second case than in the first one. best wishes, Adelchi PR PR PR -- PR Gregory (Greg) L. Snow Ph.D. PR Statistical Data Center PR Intermountain Healthcare PR [EMAIL PROTECTED] PR (801) 408-8111 PR PR PR -Original Message- PR From: [EMAIL PROTECTED] PR [mailto:[EMAIL PROTECTED] On Behalf Of Pedro PR Ramirez Sent: Wednesday, June 07, 2006 11:00 AM PR To: r-help@stat.math.ethz.ch PR Subject: [R] Density Estimation PR PR Dear R-list, PR PR I have made a simple kernel density estimation by PR PR x - c(2,1,3,2,3,0,4,5,10,11,12,11,10) PR kde - density(x,n=100) PR PR Now I would like to know the estimated probability that a new PR observation falls into the interval 0x3. PR PR How can I integrate over the corresponding interval? PR In several R-packages for kernel density estimation I did not PR found a corresponding function. I could apply Simpson's Rule for PR integrating, but perhaps somebody knows a better solution. PR PR Thanks a lot for help! PR PR Pedro PR PR _ PR PR __ PR R-help@stat.math.ethz.ch mailing list PR https://stat.ethz.ch/mailman/listinfo/r-help PR PLEASE do read the posting guide! PR http://www.R-project.org/posting-guide.html PR PR PR __ PR R-help@stat.math.ethz.ch mailing list PR https://stat.ethz.ch/mailman/listinfo/r-help PR PLEASE do read the posting guide! PR http://www.R-project.org/posting-guide.html PR __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] reversed dendogram
Dear All, I am trying to find a way to plot a dendogram in reverse, that is, if the terminal leaves are labelled 1-10 bottom to top (or left to right), I would like to be able to plot it in a way such that if would display 10-1 bottom to top or left to right. Any idea how to achieve this? Thanks in advance, r. Dr. Rafael Najmanovich European Bioinformatics Institute Wellcome Trust Genome Campus Cambridge CB10 1SD United Kingdom [EMAIL PROTECTED] - www.ebi.ac.uk/~rafi +44-1223-492599 (voice) +44-7786-968257(mobile) +44-1223-494468 (fax) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Re-binning histogram data
I would argue that histograms are outdated relics and that density plots (whatever your favorite flavor is) should **always** be used instead these days. In this vein, I would appreciate critical rejoinders (public or private) to the following proposition: Given modern computer power and software like R on multi ghz machines, statistical and graphical relics of the pre-computer era (like histograms, low resolution printer-type plots, and perhaps even method of moments EMS calculations) should be abandoned in favor of superior but perhaps computation-intensive alternatives (like density plots, high resolution plots, and likelihood or resampling or Bayes based methods). NB: Please -- no pleadings that new methods would be mystifying to the non-cogniscenti. Following that to its logical conclusion would mean that we'd all have to give up our TV remotes and cell phones, and what kind of world would that be?! :-) -- Bert Gunter -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Petr Pikal Sent: Thursday, June 08, 2006 6:17 AM To: Justin Ashmall; r-help@stat.math.ethz.ch Subject: Re: [R] Re-binning histogram data On 8 Jun 2006 at 11:35, Justin Ashmall wrote: Date sent:Thu, 8 Jun 2006 11:35:46 +0100 (BST) From: Justin Ashmall [EMAIL PROTECTED] To: Petr Pikal [EMAIL PROTECTED] Copies to:r-help@stat.math.ethz.ch Subject: Re: [R] Re-binning histogram data Thanks for the reply Petr, It looks to me that truehist() needs a vector of data just like hist()? Whereas I have histogram-style input data? Am I missing something? Well, maybe you could use barplot. Or as you suggested recreate the original vector and call hist or truehist with other bins. hhh-hist(rnorm(1000)) barplot(tapply(hhh$counts, c(rep(1:7,each=2),7), sum)) tapply(hhh$mids, c(rep(1:7,each=2),7), mean) 1 2 3 4 5 6 7 -3.00 -2.00 -1.00 0.00 1.00 2.00 3.25 hhh1-rep(hhh$mids,hhh$counts) plot(hhh, freq=F) lines(density(hhh1)) HTH Petr Cheers, Justin On Thu, 8 Jun 2006, Petr Pikal wrote: Hi try truehist from MASS package and look for argument breaks or h. HTH Petr On 8 Jun 2006 at 10:46, Justin Ashmall wrote: Date sent:Thu, 8 Jun 2006 10:46:19 +0100 (BST) From: Justin Ashmall [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject: [R] Re-binning histogram data Hi, Short Version: Is there a function to re-bin a histogram to new, broader bins? Long version: I'm trying to create a histogram, however my input-data is itself in the form of a fine-grained histogram, i.e. numbers of counts in regular one-second bins. I want to produce a histogram of, say, 10-minute bins (though possibly irregular bins also). I suppose I could re-create a data set as expected by the hist() function (i.e. if time t=3600 has 6 counts, add six entries of 3600 to a list) however this seems neither elegant nor efficient (though I'd be pleased to be mistaken!). I could then re-create a histogram as normal. I guessing there's a better solution however! Apologies if this is a basic question - I'm rather new to R and trying to get up to speed. Regards, Justin __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] reversed dendogram
In order to plot a reversed a dendrogram, simply use rev(). r. On 8 Jun 2006, at 16:30, Rafael Najmanovich wrote: Dear All, I am trying to find a way to plot a dendogram in reverse, that is, Dr. Rafael Najmanovich European Bioinformatics Institute Wellcome Trust Genome Campus Cambridge CB10 1SD United Kingdom [EMAIL PROTECTED] - www.ebi.ac.uk/~rafi +44-1223-492599 (voice) +44-7786-968257(mobile) +44-1223-494468 (fax) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Using data=x or subset=y in user-defined functions
On Wed, 2006-06-07 at 21:36 +0100, Prof Brian Ripley wrote: I suggest you investigate with(). Thanks! Just to be sure, the following will do what I want? eg.function - function(x, data=NULL, subset=NULL, ...) { with(if(is.null(subset)) data else subset(data,subset), { ... }) } On Wed, 7 Jun 2006, Manuel Morales wrote: Dear list members, In some of my functions, I attach the data internally to allow subset commands or to specify a data frame. This works well except for cases where there is a masking conflict (which returns a warning). I see some alternative listed in ?attach, but I'm not sure which of them do what I'd like. Any suggestions? Below is how I've been setting up my functions: # Set up environment on.exit(detach(data)) attach(data) if(!is.null(subset)) { data-subset(data,subset) detach(data) attach(data) } subset = NULL # Function body here output - x return(output) } Thanks! Manuel __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Re-binning histogram data
On 08-Jun-06 Berton Gunter wrote: I would argue that histograms are outdated relics and that density plots (whatever your favorite flavor is) should **always** be used instead these days. In this vein, I would appreciate critical rejoinders (public or private) to the following proposition: Given modern computer power and software like R on multi ghz machines, statistical and graphical relics of the pre-computer era (like histograms, low resolution printer-type plots, and perhaps even method of moments EMS calculations) should be abandoned in favor of superior but perhaps computation-intensive alternatives (like density plots, high resolution plots, and likelihood or resampling or Bayes based methods). While your head is above the parapet, Bert ... Your general question could go in many directions, but there's a lot to be said for that point of view (as well as some against). However, my short answer is that it's a matter of horses for courses. In particular, where the histogram is concerned, it has a straightforward property that it exactly represents the information about the counts within the bin-ranges. While usually the bars are not labelled with count values, you can (and I quite often have, when it was the only way) recover the counts using a ruler graduated in millimetres. And the same time it usually (if judiciously constructed) presents a good blockwise representation of the implied underlying continuous distribution. A continuous density estimation may be a better and smoother (or at least more appealing) representation of the distribution (though you would need to be careful about local humps), but to recover the data from it would take a combination of optical scanning, image analysis software, and (if you don't know what smoothing method was used) heuristic algorithm-inference software. Well within your technological utopia, of course, but ... NB: Please -- no pleadings that new methods would be mystifying to the non-cogniscenti. Following that to its logical conclusion would mean that we'd all have to give up our TV remotes and cell phones, and what kind of world would that be?! :-) One day, let me show you how to use my wooden plough-share. Best wishes, Ted. PS Please bring your own horse. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 08-Jun-06 Time: 17:16:53 -- XFMail -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] [Fwd: R 2.20 Windows XP anaolgue of Splus unix() command ?]
Hi Everyone : As I mentioned earlier, I am taking a lot of Splus code and turning into R and I've run into another stumbling block that I have not been able to figure out. I did plotting in a loop when I was using Splus on unix and the way I made the plots stop so I could lookat them as they got plotted ( there are hundreds if not thousands getting plotted sequentially ) on the screen was by using the unix() command. Basically, I wrote a function called wait() wait-function() { cat(press return to continue) unix(read stuff) } and this worked nicely because I then did source(program name) at the Splus prompt and a plot was created on the screen and then the wait() function was right under the plotting code in the program so that you had to hit the return key to go to the next plot. I am trying to do the equivalent on R 2.20/windows XP I did a ?unix in R and it came back with system() and said unix was deprecated so I replaced unix(read stuff) with system(read stuff) but all i get is a warning read not found and it flies through the successive plots and i can't see them. Thanks for any help on this. It's much appreciated. Mark __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] [R-pkgs] New R package pcalg
The R package pcalg is released. The main purpose of this package is to estimate the skeleton of a DAG given data sampled from a distribution corresponding to this DAG. More intuitively, you can search for strong dependencies in potentially high dimensional data sets. The result will be an undirected graph where each edge represents some dependence statement. Optionally, the line width can be varied in order to indicate the reliability of the dependencies found. For more details have a look at the vignette. I'd be happy to receive comments and suggestions for improvement. ___ R-packages mailing list [EMAIL PROTECTED] https://stat.ethz.ch/mailman/listinfo/r-packages __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] apologies if you aready received this ?
I am accessing my email account remotely so it seems to be acting strangely so I am not sure if this R question was received. I apologize if it was and thanks for any help you can provide. - Hi Everyone : As I mentioned earlier, I am taking a lot of Splus code and turning into R and I've run into another stumbling block that I have not been able to figure out. I did plotting in a loop when I was using Splus on unix and the way I made the plots stop so I could lookat them as they got plotted ( there are hundreds if not thousands getting plotted sequentially ) on the screen was by using the unix() command. Basically, I wrote a function called wait() wait-function() { cat(press return to continue) unix(read stuff) } and this worked nicely because I then did source(program name) at the Splus prompt and a plot was created on the screen and then the wait() function was right under the plotting code in the program so that you had to hit the return key to go to the next plot. I am trying to do the equivalent on R 2.20/windows XP I did a ?unix in R and it came back with system() and said unix was deprecated so I replaced unix(read stuff) with system(read stuff) but all i get is a warning read not found and it flies through the successive plots and i can't see them. Thanks for any help on this. It's much appreciated. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] convert type list to character
How do I convert a type list to character, so that I can use the identical(x,y)? Currently x is type list and y is type character. Thanks, Kim - CONFIDENTIALITY NOTICE: This message and any attachments rel...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] apologies if you aready received this ?
?readline -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, June 08, 2006 9:47 AM To: r-help@stat.math.ethz.ch Subject: [R] apologies if you aready received this ? I am accessing my email account remotely so it seems to be acting strangely so I am not sure if this R question was received. I apologize if it was and thanks for any help you can provide. - Hi Everyone : As I mentioned earlier, I am taking a lot of Splus code and turning into R and I've run into another stumbling block that I have not been able to figure out. I did plotting in a loop when I was using Splus on unix and the way I made the plots stop so I could lookat them as they got plotted ( there are hundreds if not thousands getting plotted sequentially ) on the screen was by using the unix() command. Basically, I wrote a function called wait() wait-function() { cat(press return to continue) unix(read stuff) } and this worked nicely because I then did source(program name) at the Splus prompt and a plot was created on the screen and then the wait() function was right under the plotting code in the program so that you had to hit the return key to go to the next plot. I am trying to do the equivalent on R 2.20/windows XP I did a ?unix in R and it came back with system() and said unix was deprecated so I replaced unix(read stuff) with system(read stuff) but all i get is a warning read not found and it flies through the successive plots and i can't see them. Thanks for any help on this. It's much appreciated. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] BioC2006 Conference, Aug 3-4 in Seattle
Early registration ends July 1 BioC2006August 3-4 in Seattle, WA, USA http://bioconductor.org/BioC2006/ About BioC2006: This conference highlights developments within and beyond Bioconductor and provides a forum to discuss the use and design of software for analyzing data arising in biology. Format: * Scientific talks on both days from 8:30-12:00 * Hands-on lab sessions on both afternoons 2:00-5:00 Find out who is speaking and more by visiting the website: http://bioconductor.org/BioC2006/ (You will be redirected to our secure server: https://cobra.fhcrc.org/BioC2006/) Best Wishes, + seth PS: There will also be a developer focused meeting the day before the conference, August 2nd. For details, please see: http://wiki.fhcrc.org/bioc/BioC2006/DeveloperDay __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Re-binning histogram data
histograms [...] should be abandoned in favor of [...] density plots. I take your point Bert, but I think there is value in data that is simple and can be intuitively understood. For my application, 10-minutes is a good charactersitic chunk of time, and I have an intuitive feeling of how many events I would expect to see in a 10-minute period. By looking at a histogram with 10-minute bins I can tell immediately if something looks amiss. I could not do this simply with a pdf. Similarly histograms have the nice feature of compartmentalising bad data. Perhaps this is practical-use vs mathematical-idealism? Also it's a case of simple tools for simple jobs. If the handle is loose on my kitchen cabient, I tighten the screw with a screwdriver or even the tip of a knife from the drawer. I don't need my power-drill with torque-controlled screwdriver attachement, much as I love it. Justin On Thu, 8 Jun 2006, Berton Gunter wrote: I would argue that histograms are outdated relics and that density plots (whatever your favorite flavor is) should **always** be used instead these days. In this vein, I would appreciate critical rejoinders (public or private) to the following proposition: Given modern computer power and software like R on multi ghz machines, statistical and graphical relics of the pre-computer era (like histograms, low resolution printer-type plots, and perhaps even method of moments EMS calculations) should be abandoned in favor of superior but perhaps computation-intensive alternatives (like density plots, high resolution plots, and likelihood or resampling or Bayes based methods). NB: Please -- no pleadings that new methods would be mystifying to the non-cogniscenti. Following that to its logical conclusion would mean that we'd all have to give up our TV remotes and cell phones, and what kind of world would that be?! :-) -- Bert Gunter -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Petr Pikal Sent: Thursday, June 08, 2006 6:17 AM To: Justin Ashmall; r-help@stat.math.ethz.ch Subject: Re: [R] Re-binning histogram data On 8 Jun 2006 at 11:35, Justin Ashmall wrote: Date sent: Thu, 8 Jun 2006 11:35:46 +0100 (BST) From:Justin Ashmall [EMAIL PROTECTED] To: Petr Pikal [EMAIL PROTECTED] Copies to: r-help@stat.math.ethz.ch Subject: Re: [R] Re-binning histogram data Thanks for the reply Petr, It looks to me that truehist() needs a vector of data just like hist()? Whereas I have histogram-style input data? Am I missing something? Well, maybe you could use barplot. Or as you suggested recreate the original vector and call hist or truehist with other bins. hhh-hist(rnorm(1000)) barplot(tapply(hhh$counts, c(rep(1:7,each=2),7), sum)) tapply(hhh$mids, c(rep(1:7,each=2),7), mean) 1 2 3 4 5 6 7 -3.00 -2.00 -1.00 0.00 1.00 2.00 3.25 hhh1-rep(hhh$mids,hhh$counts) plot(hhh, freq=F) lines(density(hhh1)) HTH Petr Cheers, Justin On Thu, 8 Jun 2006, Petr Pikal wrote: Hi try truehist from MASS package and look for argument breaks or h. HTH Petr On 8 Jun 2006 at 10:46, Justin Ashmall wrote: Date sent: Thu, 8 Jun 2006 10:46:19 +0100 (BST) From: Justin Ashmall [EMAIL PROTECTED] To:r-help@stat.math.ethz.ch Subject: [R] Re-binning histogram data Hi, Short Version: Is there a function to re-bin a histogram to new, broader bins? Long version: I'm trying to create a histogram, however my input-data is itself in the form of a fine-grained histogram, i.e. numbers of counts in regular one-second bins. I want to produce a histogram of, say, 10-minute bins (though possibly irregular bins also). I suppose I could re-create a data set as expected by the hist() function (i.e. if time t=3600 has 6 counts, add six entries of 3600 to a list) however this seems neither elegant nor efficient (though I'd be pleased to be mistaken!). I could then re-create a histogram as normal. I guessing there's a better solution however! Apologies if this is a basic question - I'm rather new to R and trying to get up to speed. Regards, Justin __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] apologies if you aready received this ?
[EMAIL PROTECTED] writes: Basically, I wrote a function called wait() wait-function() { cat(press return to continue) unix(read stuff) } Is readline what you want? See help(readline). __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Re-binning histogram data
Hi, Bert, Ted, et al.: Do you use normal probability plots? They are the best tool I know for identifying all kinds of nonnormality, including normal mixtures with either outliers or multimodality as well as skewness. I've experimented with PP and nonnormal QQ plots, and not found them that useful. I prefer to transform the data to apparent normality, because that seems to produce about the right amount of visual separation in the tails: A PP plot provides very poor resolution of tail behavior, and the image in a QQ plot with longer than normal tails becomes for me so overwhelmed by random tail behavior that I'm unable to make sense of it. Also, could someone explain the rationale behind the datax=FALSE default? I presume this default was established before research showed that humans have better judgment about vertical and horizontal lines than lines at other angles, and that 45 degree lines are more easily judged than lines at other angles. This research led to the 45 degree banking rule (see _Visualizing Data_ by William S. Cleveland for details), mentioned on the help page for xyplot{lattice}. In my experience, most normal probability plots come closer to meeting this 45 degree banking rule when datax=TRUE than FALSE. With a typical aspect ratio, normally distributed data will appear with an angle less than 45 degrees. An outlier with the default datax=FALSE will reduce that 45 degrees, making it harder to process visually. By contrast, with datax=TRUE, an outlier increases the banking, moving it closer to (or even beyond) the 45 degree line that seems to facilitate the best human visual processing. Beyond this, what do you think about combining a normal plot with either a histogram or a density estimate on the bottom? With multiple lines on the normal probability plot, I've seen stacked-bar histograms on the bottom that seemed intelligible. Would you suggest replacing stacked-bar histograms with overlapping plots of density estimates? And how many observations would you need in each group for that to make sense? What do you think? Best Wishes, Spencer Graves (Ted Harding) wrote: On 08-Jun-06 Berton Gunter wrote: I would argue that histograms are outdated relics and that density plots (whatever your favorite flavor is) should **always** be used instead these days. In this vein, I would appreciate critical rejoinders (public or private) to the following proposition: Given modern computer power and software like R on multi ghz machines, statistical and graphical relics of the pre-computer era (like histograms, low resolution printer-type plots, and perhaps even method of moments EMS calculations) should be abandoned in favor of superior but perhaps computation-intensive alternatives (like density plots, high resolution plots, and likelihood or resampling or Bayes based methods). While your head is above the parapet, Bert ... Your general question could go in many directions, but there's a lot to be said for that point of view (as well as some against). However, my short answer is that it's a matter of horses for courses. In particular, where the histogram is concerned, it has a straightforward property that it exactly represents the information about the counts within the bin-ranges. While usually the bars are not labelled with count values, you can (and I quite often have, when it was the only way) recover the counts using a ruler graduated in millimetres. And the same time it usually (if judiciously constructed) presents a good blockwise representation of the implied underlying continuous distribution. A continuous density estimation may be a better and smoother (or at least more appealing) representation of the distribution (though you would need to be careful about local humps), but to recover the data from it would take a combination of optical scanning, image analysis software, and (if you don't know what smoothing method was used) heuristic algorithm-inference software. Well within your technological utopia, of course, but ... NB: Please -- no pleadings that new methods would be mystifying to the non-cogniscenti. Following that to its logical conclusion would mean that we'd all have to give up our TV remotes and cell phones, and what kind of world would that be?! :-) One day, let me show you how to use my wooden plough-share. Best wishes, Ted. PS Please bring your own horse. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 08-Jun-06 Time: 17:16:53 -- XFMail -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide!
Re: [R] apologies if you aready received this ?
On 6/8/2006 12:47 PM, [EMAIL PROTECTED] wrote: I am accessing my email account remotely so it seems to be acting strangely so I am not sure if this R question was received. I apologize if it was and thanks for any help you can provide. - Hi Everyone : As I mentioned earlier, I am taking a lot of Splus code and turning into R and I've run into another stumbling block that I have not been able to figure out. I did plotting in a loop when I was using Splus on unix and the way I made the plots stop so I could lookat them as they got plotted ( there are hundreds if not thousands getting plotted sequentially ) on the screen was by using the unix() command. Basically, I wrote a function called wait() wait-function() { cat(press return to continue) unix(read stuff) } You can also use par(ask=TRUE) to get R to pause the script whenever it is about to erase the graphics window. Duncan Murdoch and this worked nicely because I then did source(program name) at the Splus prompt and a plot was created on the screen and then the wait() function was right under the plotting code in the program so that you had to hit the return key to go to the next plot. I am trying to do the equivalent on R 2.20/windows XP I did a ?unix in R and it came back with system() and said unix was deprecated so I replaced unix(read stuff) with system(read stuff) but all i get is a warning read not found and it flies through the successive plots and i can't see them. Thanks for any help on this. It's much appreciated. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Density Estimation
In mathematical terms the optimal bandwith for density estimation decreases at rate n^{-1/5}, while the one for distribution function decreases at rate n^{-1/3}, if n is the sample size. In practical terms, one must choose an appreciably smaller bandwidth in the second case than in the first one. Thanks a lot for your remark! I was not aware of the fact that the optimal bandwidths for density and distribution do not decrease at the same rate. Besides the computational aspect, there is a statistical one: the optimal choice of bandwidth for estimating the density function is not optimal (and possibly not even jsut sensible) for estimating the distribution function, and the stated problem is equivalent to estimation of the distribution function. The given interval 0x3 was only an example, in fact I would like to estimate the probability for intervals such as 0=x1 , 1=x2 , 2=x3 , 3=x4 , and compare it with the estimates of a corresponding histogram. In this case the stated problem is not anymore equivalent to the estimation of the distribution function. What do you think, can I go a ahead in this case with the optimal bandwidth for the density? Thanks a lot for your help! Best wishes Pedro best wishes, Adelchi PR PR PR -- PR Gregory (Greg) L. Snow Ph.D. PR Statistical Data Center PR Intermountain Healthcare PR [EMAIL PROTECTED] PR (801) 408-8111 PR PR PR -Original Message- PR From: [EMAIL PROTECTED] PR [mailto:[EMAIL PROTECTED] On Behalf Of Pedro PR Ramirez Sent: Wednesday, June 07, 2006 11:00 AM PR To: r-help@stat.math.ethz.ch PR Subject: [R] Density Estimation PR PR Dear R-list, PR PR I have made a simple kernel density estimation by PR PR x - c(2,1,3,2,3,0,4,5,10,11,12,11,10) PR kde - density(x,n=100) PR PR Now I would like to know the estimated probability that a new PR observation falls into the interval 0x3. PR PR How can I integrate over the corresponding interval? PR In several R-packages for kernel density estimation I did not PR found a corresponding function. I could apply Simpson's Rule for PR integrating, but perhaps somebody knows a better solution. PR PR Thanks a lot for help! PR PR Pedro PR PR _ PR PR __ PR R-help@stat.math.ethz.ch mailing list PR https://stat.ethz.ch/mailman/listinfo/r-help PR PLEASE do read the posting guide! PR http://www.R-project.org/posting-guide.html PR PR PR __ PR R-help@stat.math.ethz.ch mailing list PR https://stat.ethz.ch/mailman/listinfo/r-help PR PLEASE do read the posting guide! PR http://www.R-project.org/posting-guide.html PR __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] apologies if you aready received this ?
Seth Falcon [EMAIL PROTECTED] writes: [EMAIL PROTECTED] writes: Basically, I wrote a function called wait() wait-function() { cat(press return to continue) unix(read stuff) } Is readline what you want? See help(readline). ...and the generic issue here is that system() calls the system shell, and if that doesn't know of a read command, you're up the proverbial roof without a paddle. If you really insist of unix() functionality, you need a Unix-like subsystem. You could start by installing bash.exe and do things like system(bash -c read stuff) but you'll soon realize that you also need all of the programs that are traditionally available on Unix. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Using data=x or subset=y in user-defined functions
On Thu, 2006-06-08 at 11:54 -0400, Manuel Morales wrote: On Wed, 2006-06-07 at 21:36 +0100, Prof Brian Ripley wrote: I suggest you investigate with(). Thanks for the suggestion! Unfortunately, it's not clear to me how to call with() from a function. The example below fails with the error message: 'Error in mean(x) : object a not found' data.test - data.frame(a=c(1:10),b=rnorm(10)) eg.function - function(x, data) with(data, return(mean(x))) eg.function(a,data.test) Manuel Thanks! Just to be sure, the following will do what I want? eg.function - function(x, data=NULL, subset=NULL, ...) { with(if(is.null(subset)) data else subset(data,subset), { ... }) } On Wed, 7 Jun 2006, Manuel Morales wrote: Dear list members, In some of my functions, I attach the data internally to allow subset commands or to specify a data frame. This works well except for cases where there is a masking conflict (which returns a warning). I see some alternative listed in ?attach, but I'm not sure which of them do what I'd like. Any suggestions? Below is how I've been setting up my functions: # Set up environment on.exit(detach(data)) attach(data) if(!is.null(subset)) { data-subset(data,subset) detach(data) attach(data) } subset = NULL # Function body here output - x return(output) } Thanks! Manuel __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] nested mixed-effect model: variance components
Dear listers, I am trying to assess variance components for a nested, mixed-effects model. I think I got an answer that make sense from R, but I have a warning message and I wanted to check that what I am looking at is actually what I need: my data are organized as transects within stations, stations within habitats, habitats within lagoons. lagoons: random, habitats: fixed the question is: how much variation is due to lagoons? habitats? lagoons*habitat? transects? Here is my code: res - aov(COVER ~ HABITAT + Error(HABITAT+LAGOON+LAGOON/HABITAT), data=cov) summary(res) and I get Sum Sq for each to calculate variance components: Error: STRATE Df Sum Sq Mean Sq STRATE 5 4493.1 898.6 Error: ATOLL Df Sum Sq Mean Sq F value Pr(F) Residuals 5 3340.5 668.1 Error: STRATE:ATOLL Df Sum Sq Mean Sq F value Pr(F) Residuals 18 2442.71 135.71 Error: Within Df Sum Sq Mean Sq F value Pr(F) Residuals 145 6422.044.3 My error message seems to come from the LAGOON/HABITAT, the Error is computed. Warning message: Error() model is singular in: aov(COVER ~ HABITAT + Error(HABITAT+LAGOON+LAGOON/HABITAT), data=cov), THANKS !!! eric Eric Pante College of Charleston, Grice Marine Laboratory 205 Fort Johnson Road, Charleston SC 29412 Phone: 843-953-9190 (lab) -9200 (main office) On ne force pas la curiosite, on l'eveille ... Daniel Pennac __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Using data=x or subset=y in user-defined functions
On 6/8/2006 2:56 PM, Manuel Morales wrote: On Thu, 2006-06-08 at 11:54 -0400, Manuel Morales wrote: On Wed, 2006-06-07 at 21:36 +0100, Prof Brian Ripley wrote: I suggest you investigate with(). Thanks for the suggestion! Unfortunately, it's not clear to me how to call with() from a function. The example below fails with the error message: 'Error in mean(x) : object a not found' data.test - data.frame(a=c(1:10),b=rnorm(10)) eg.function - function(x, data) with(data, return(mean(x))) eg.function(a,data.test) When you call a function in R, you normally need to have the variables defined in the local environment. You are trying to pass a variable named a to your function (where a copy will be made in the local variable x), but there is no variable a to pass. I think what you want to do is to pass an expression a to your function, and have the function evaluate that expression within your dataframe, i.e. you don't want the standard evaluation method to be used. To do that you'd do something like this: eg.function - function(expr, data) { + x - eval(substitute(expr), envir=data) + return(mean(x)) + } eg.function(a, data.test) [1] 5.5 The substitute says to give back the unevaluated expression used for the argument. Duncan Murdoch Manuel Thanks! Just to be sure, the following will do what I want? eg.function - function(x, data=NULL, subset=NULL, ...) { with(if(is.null(subset)) data else subset(data,subset), { ... }) } On Wed, 7 Jun 2006, Manuel Morales wrote: Dear list members, In some of my functions, I attach the data internally to allow subset commands or to specify a data frame. This works well except for cases where there is a masking conflict (which returns a warning). I see some alternative listed in ?attach, but I'm not sure which of them do what I'd like. Any suggestions? Below is how I've been setting up my functions: # Set up environment on.exit(detach(data)) attach(data) if(!is.null(subset)) { data-subset(data,subset) detach(data) attach(data) } subset = NULL # Function body here output - x return(output) } Thanks! Manuel __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Error in plot.new() : plot region too large ?
Hello. I want to draw the contour map by package CTFs. But: Error in plot.new() : plot region too large # the plot area is 1000 * 500. How to solve this trouble? Thanks! Jian zhang [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] JGR :: Can't Run Graphics Demo
Hi: I have verified that javaGD, rJava, iplots, and iwidgets are installed.I am still not able to run any of the graphics demos. I still get the following error: if (dev.cur() = 1) get(getOption(device))() Error in get(getOption(device))() : unable to start device JavaGD Any help would be appreciated, Thanks: Alex From: ronggui [EMAIL PROTECTED] To: Alex Restrepo [EMAIL PROTECTED] CC: r-help@stat.math.ethz.ch Subject: Re: [R] JGR :: Can't Run Graphics Demo Date: Thu, 8 Jun 2006 21:47:07 +0800 Have you installed the following packages?They are javaGD,rJava,iplots,iWidgets? It seems that you have installed the javaGD package. 2006/6/8, Alex Restrepo [EMAIL PROTECTED]: Hello: I am using JGR 1.4, the Java GUI for R and I am trying to run the demo for graphics using the command: demo(graphics) I keep on getting the following errror: Error in get(getOption(device))() : unable to start device JavaGD FYI, the version of Java I am using is: 1.5.0_07-b03 Do I need to use a different version of Java? Does anyone have any recommendations/suggestions? Many Thanks In Advance: Alex __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- »ÆÈÙ¹ó Deparment of Sociology Fudan University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] JGR :: Can't Run Graphics Demo
I tried to create a pie chart in JGR, via the command: pie(rep(1, 24), col = rainbow(24), radius = 0.9) and I still get the following error: Error in JavaGD() : unable to start device JavaGD From: Alex Restrepo [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: r-help@stat.math.ethz.ch Subject: Re: [R] JGR :: Can't Run Graphics Demo Date: Thu, 08 Jun 2006 15:48:07 -0500 Hi: I have verified that javaGD, rJava, iplots, and iwidgets are installed. I am still not able to run any of the graphics demos. I still get the following error: if (dev.cur() = 1) get(getOption(device))() Error in get(getOption(device))() : unable to start device JavaGD Any help would be appreciated, Thanks: Alex From: ronggui [EMAIL PROTECTED] To: Alex Restrepo [EMAIL PROTECTED] CC: r-help@stat.math.ethz.ch Subject: Re: [R] JGR :: Can't Run Graphics Demo Date: Thu, 8 Jun 2006 21:47:07 +0800 Have you installed the following packages?They are javaGD,rJava,iplots,iWidgets? It seems that you have installed the javaGD package. 2006/6/8, Alex Restrepo [EMAIL PROTECTED]: Hello: I am using JGR 1.4, the Java GUI for R and I am trying to run the demo for graphics using the command: demo(graphics) I keep on getting the following errror: Error in get(getOption(device))() : unable to start device JavaGD FYI, the version of Java I am using is: 1.5.0_07-b03 Do I need to use a different version of Java? Does anyone have any recommendations/suggestions? Many Thanks In Advance: Alex __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- »ÆÈÙ¹ó Deparment of Sociology Fudan University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Formatting numbers for printing
Colleagues I have numbers like 12012 that I will be printing in a graphic. I would like to format them as follows: 012-012, i.e., the first two digits padded to the left by a zero, followed by a dash, followed by the final three digits, also padded to the left by zeros. I can do this with brute force: FirstPart - sprintf(%03d, floor(Number / 1000)) SecondPart - sprintf(%03d, WhichID %% 1000) Combined- paste(FirstPart, -, SecondPart, sep=) But, I suspect that there is some more clever means to accomplish this using formatC or sprintf. Unfortunately, the help pages don't provide sufficient insight. I would appreciate any tricks to accomplish this. Dennis Dennis Fisher MD P (The P Less Than Company) Phone: 1-866-PLessThan (1-866-753-7784) Fax: 1-415-564-2220 www.PLessThan.com [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Dimension Err using marks in ppp.object
I want to generate a ppp object (spastat R package) using the command 'ppp' and 3 vectors containing coordinates and numeric mark data, but I get an error I don't understand. The command is: index10.ppp - ppp(x, y, c(20,240), c(140,780), marks=z) where: x is a numeric vector of integers that represents the x-coordinate in the plane y is a numeric vector of integers that represents the y-coordinate in the plane z is a numeric vector of doubles (float) that represents the values of an index measured at each x-y point The values given for owin are the corners of the experimental plot Here is the error message: Attempted to create point pattern with 1 columns of mark data; multidimensional marks are not yet implemented How can 1 column of data be multidimensional? Does this error refer to my use of integer coordinates and double marks? Is there a work around? I'm using R for Mac OS X. The version of R is: 1.15, framework R 2.3.0. The version of spastat is: 1.9-1. Any advice is appreciated. MF __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Formatting numbers for printing
On 6/8/2006 5:42 PM, Dennis Fisher wrote: Colleagues I have numbers like 12012 that I will be printing in a graphic. I would like to format them as follows: 012-012, i.e., the first two digits padded to the left by a zero, followed by a dash, followed by the final three digits, also padded to the left by zeros. I can do this with brute force: FirstPart - sprintf(%03d, floor(Number / 1000)) SecondPart- sprintf(%03d, WhichID %% 1000) Combined - paste(FirstPart, -, SecondPart, sep=) But, I suspect that there is some more clever means to accomplish this using formatC or sprintf. Unfortunately, the help pages don't provide sufficient insight. I would appreciate any tricks to accomplish this. I think you need to do the separation into two parts as you did (or using %/%), but it can all be one sprintf: sprintf(%03d-%03d, Number %/% 1000, Number %% 1000) Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] make check errors for R-2.3.1
Hello all, I tried to build R-2.3.1 from source under Mac OS X 10.4.6. (I am doing so because only this way I can get the 64-bit version of R) The configure and make steps look fine. But I got errors when I did make check-all, here is the message: running code in 'base-Ex.R' ...make[4]: *** [base-Ex.Rout] Error 1 make[3]: *** [test-Examples-Base] Error 2 make[2]: *** [test-Examples] Error 2 make[1]: *** [test-all-basics] Error 1 make: *** [check-all] Error 2 I am not sure what does this mean. One potentially related issue is that, I downloaded and installed a gfortran compiler: GNU Fortran 95 (GCC) 4.2.0 20060512 (experimental), because we don¡¯t have one originally. But I didn¡¯t use the latest cctools, and our version is: Apple Computer, Inc. version cctools-590.23.2.obj~17. Not sure whether this matters. Our gcc compiler is: powerpc-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5250). Please let me know if you have any idea about it. Thank you. Weijun __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Re-binning histogram data
[Berton Gunter] I would argue that histograms are outdated relics and that density plots (whatever your favorite flavor is) should **always** be used instead these days. When a now retired researcher paid us a visit, I showed him a density plot produced by R over some data he did work a lot, before he left. I, too, find them rather sexy, and I wanted to impress him with some of the pleasures of R, especially knowing he has been a dedicated user of SAS in his times. Yet, this old and wise man _immediately_ caught that the density curve was leaking a tiny bit through the extrema. Not a big deal of course -- and he did like what he saw. Nevertheless, this reminded me that we should be careful at not dismissing too lightly years of accumulated knowledge, experience and know-how, merely because we give in joyful enthusiasm for more recent things. Let me make a comparison, looking at the R mailing lists themselves. Some would much like sending HTML email in here: they would get colours, use various fonts, offer links, and have indentation which dynamically adapts on the receiving end to the window size of the reading guy. But the collective wisdom is to stick to non-HTML email, which is quite proven and still very functional, after all. Some impatient people or dubious tools use other things than fixed-width fonts while presenting text/plain email, or merely ignore the usual 79-column limit and other oldish etiquette issues while sending it: in last analysis, they kibitz the community more than they help it, and deep down, are a bit selfish. There is a long way to go before HTML email is really ubiquitous and correctly supported. Consider the long time MIME took to establish itself: even now, email readers correctly supporting MIME are hard to find -- most are fond on gadgets much more than they know standards. Another comparison which pops to my mind is how some people fanatically try to impose UTF-8 all around, saying that ASCII or ISO-8859-1 (and many others) are part of the prehistory of computers. When mere users, they can always talk without making too much damage. But I've seen a few maintainers going overboard on such matters, consciously breaking software to force their convictions forward: Crois ou meurs! as we say in French (approximately: Believe or perish!). Here, just like for HTML mail or nicer bitmapped R graphics, Unicode does have technical merit; the truth is that we are _far_ from mastering everything about it, and there are lots of open issues that are not strictly technical. Many proponent of these various things are tempted to say that they want to clean out the planet of outdated relics (I liked your expression!) and have the honest feeling they do trigger overall progress. Moreover, new good things do not necessarily make older things wrong. In a word, we should rather wait for progress with calm, and with respectful care of what already exists. Progress will impose itself slowly over time, and is not so much in need of forceful evangelists. :-) -- François Pinard http://pinard.progiciels-bpi.ca __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Re-binning histogram data
Concerning the several comments on your note relating to histograms, an informative and entertaining illustration, using Java, of how your subjective assessment of the data can change with different histograms constructed from the same data, is provided by R. Webster West, recently with the Department of Statistics at the University of South Carolina, but as of May 2006 with the Department of Statistics at Texas A M University, http://www.stat.sc.edu/~west/javahtml/Histogram.html and http://www.stat.tamu.edu/~west/ Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Justin Ashmall Sent: Thursday, June 08, 2006 5:46 AM To: r-help@stat.math.ethz.ch Subject: [R] Re-binning histogram data Hi, Short Version: Is there a function to re-bin a histogram to new, broader bins? Long version: I'm trying to create a histogram, however my input-data is itself in the form of a fine-grained histogram, i.e. numbers of counts in regular one-second bins. I want to produce a histogram of, say, 10-minute bins (though possibly irregular bins also). I suppose I could re-create a data set as expected by the hist() function (i.e. if time t=3600 has 6 counts, add six entries of 3600 to a list) however this seems neither elegant nor efficient (though I'd be pleased to be mistaken!). I could then re-create a histogram as normal. I guessing there's a better solution however! Apologies if this is a basic question - I'm rather new to R and trying to get up to speed. Regards, Justin __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Re-binning histogram data
I'm not sure why you would consider density plots modern. Kernel density estimators were proposed in 1956 and 1962, though they were not used commonly until the computational powers caught up. Also, I think the advantages of density plots over histograms far out-weight their possible shortcomings. If you are unwilling to go that far, at least consider replacing histograms with ASH plots. [I wouldn't go quite as far as Bert. Occasionally I still look at histograms, but _very_ rarely.] Andy _ From: [EMAIL PROTECTED] on behalf of François Pinard Sent: Thu 6/8/2006 7:53 PM To: Berton Gunter Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Re-binning histogram data [Broadcast] [Berton Gunter] I would argue that histograms are outdated relics and that density plots (whatever your favorite flavor is) should **always** be used instead these days. When a now retired researcher paid us a visit, I showed him a density plot produced by R over some data he did work a lot, before he left. I, too, find them rather sexy, and I wanted to impress him with some of the pleasures of R, especially knowing he has been a dedicated user of SAS in his times. Yet, this old and wise man _immediately_ caught that the density curve was leaking a tiny bit through the extrema. Not a big deal of course -- and he did like what he saw. Nevertheless, this reminded me that we should be careful at not dismissing too lightly years of accumulated knowledge, experience and know-how, merely because we give in joyful enthusiasm for more recent things. Let me make a comparison, looking at the R mailing lists themselves. Some would much like sending HTML email in here: they would get colours, use various fonts, offer links, and have indentation which dynamically adapts on the receiving end to the window size of the reading guy. But the collective wisdom is to stick to non-HTML email, which is quite proven and still very functional, after all. Some impatient people or dubious tools use other things than fixed-width fonts while presenting text/plain email, or merely ignore the usual 79-column limit and other oldish etiquette issues while sending it: in last analysis, they kibitz the community more than they help it, and deep down, are a bit selfish. There is a long way to go before HTML email is really ubiquitous and correctly supported. Consider the long time MIME took to establish itself: even now, email readers correctly supporting MIME are hard to find -- most are fond on gadgets much more than they know standards. Another comparison which pops to my mind is how some people fanatically try to impose UTF-8 all around, saying that ASCII or ISO-8859-1 (and many others) are part of the prehistory of computers. When mere users, they can always talk without making too much damage. But I've seen a few maintainers going overboard on such matters, consciously breaking software to force their convictions forward: Crois ou meurs! as we say in French (approximately: Believe or perish!). Here, just like for HTML mail or nicer bitmapped R graphics, Unicode does have technical merit; the truth is that we are _far_ from mastering everything about it, and there are lots of open issues that are not strictly technical. Many proponent of these various things are tempted to say that they want to clean out the planet of outdated relics (I liked your expression!) and have the honest feeling they do trigger overall progress. Moreover, new good things do not necessarily make older things wrong. In a word, we should rather wait for progress with calm, and with respectful care of what already exists. Progress will impose itself slowly over time, and is not so much in need of forceful evangelists. :-) -- François Pinard http://pinard.progiciels-bpi.ca http://pinard.progiciels-bpi.ca/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to do this simple integration?
I can't parse your metacode, so I really don't understand your question. Have you worked the examples in the ?integrate help page? Also, do you understand the ... argument to the integrate (and other) functions? If the answer to the latter is no, I suggest you also read Venables and Ripley, Modern Applied Statistics with S. If that is not adequate and you'd like more help from this listserve, please submit a simple, self-contained example that seems to come the closest to something you want but can't quite get, as suggested in the posting guide! www.R-project.org/posting-guide.html. I know this didn't answer your question, but I hope it helps you. Best Wishes, Spencer Graves Jianing Di wrote: Hello, I have a simple function in the form as follows: f-function(x){sum(v^x)} where v is a vector. I was trying to integrate f using the command I-integrate(f,0,1) However, this will not work and seems that the reason is to use integrate, the f must be a function that with input and output of same length. Anyone can point out which command should I use in order to compute this type of integration(such as a function involve sum(), prod(), etc.)? Thank you. Jianing __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] X'W in Matrix
Hi! I have used the Matrix package (Version: 0.995-10) successfully to obtain the OLS solution for a problem where the design matrix X is 44000x6000. X is very sparse (about 8 non-zeros elements). Now I want to do WLS: (X'WX)^-1X'Wy I tried W=Diagonal(length(w),w) and wX=solve(X,W) but after various minutes R gives a not enough memory error (Im using a 64bit machine with 16Gigs of RAM). I ended up doing this: wX=Matrix(as.matrix(X)*sqrt(w),sparse=TRUE) coefs1=as.vector(solve(crossprod(wX),crossprod(X,w*y))) which takes about 1-2 minutes, but it seems a better way, using the diagonal matrix, should exist. If there is I'd appreciate hearing it. If not, Im happy waiting 1-2 minute x #of iters. Thanks, Rafael __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] making matrix monotonous
Thanks to everybody for your help. Thanks for the coding improvements and thanks for the very interesting paper. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html