[R] Sweave, xtable plus/minus sign
Dear R-users, please consider the following minimal example: \documentclass[a4paper,titlepage,onecolumn,12pt]{article} \usepackage[italian]{babel} \usepackage{amssymb} \usepackage[utf8x]{inputenc} \usepackage[pdftex]{graphicx} \begin{document} label=test, echo=FALSE, results=tex= df.data1 - cbind.data.frame(A = rnorm(18), B =factor(rep(LETTERS[1:6], each=3))) myMean - tapply(df.data1$A, df.data1$B, FUN = mean) mySD - tapply(df.data1$A, df.data1$B, FUN = sd) foo - matrix(c(myMean, mySD), ncol=2, nrow=6) colnames(foo) - c(Mean, Std.Dev) tmpTable - xtable(foo, caption =Simulated data, label=tab:four, digits=2) print(tmpTable, caption.placement=top) @ \end{document} Is it possible to insert the plus/minus sign (±) between the two columns ? I mean within R/Sweave and not in the resulting .tex file ? A possible workaround could be : ... foo.df - as.data.frame(foo) foo.df$Std.Dev - paste(±, round(mySD,2), sep=) tmpTable - xtable(foo.df, caption =Simulated data, label=tab:five, digits=2) print(tmpTable, caption.placement=top) @ Any other solution? -- Ottorino-Luca Pantani, Università di Firenze Dip.to di Scienze delle Produzioni Vegetali, del Suolo e dell'Ambiente Forestale (DiPSA) P.zle Cascine 28 50144 Firenze Italia Ubuntu 10.04 -- GNU Emacs 23.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 2.18.0) ESS version 5.8 -- R 2.10.1 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Sweave, xtable plus/minus sign
On 29/06/2010 17:36, Marc Schwartz wrote: On Jun 29, 2010, at 10:08 AM, Ottorino-Luca Pantani wrote: paste($\\pm$, 1.34, sep=) [1] $\\pm$1.34 I believe you then need to tweak the sanitize.text.function argument in print.xtable() to properly handle the backslashes. HTH, Marc Schwartz Thanks, Marc. I modified the code as follows: foo.df$Std.Dev - paste($\\pm$, round(mySD,2), sep=) tmpTable - xtable(foo.df, caption =Simulated data, label=tab:five, digits=2) print(tmpTable, caption.placement=top, sanitize.text.function= function(x){x}) which result in a .tex file like .. \begin{table}[ht] \begin{center} \caption{Simulated data} \label{tab:five} \begin{tabular}{rrl} \hline Mean Std.Dev \\ \hline 1 0.46 $\pm$0.42 \\ 2 0.81 $\pm$0.69 \\ 3 0.17 $\pm$0.56 \\ 4 0.15 $\pm$1.02 \\ 5 0.60 $\pm$1.37 \\ 6 0.48 $\pm$1.39 \\ \hline \end{tabular} \end{center} \end{table}\end{document} so it seems that there's no need to tweak the sanitize.text.function Thanks again. -- Ottorino __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Multicolor main title in a plot or mtext
Dear R-users, the problem I'm facing today is to write a multicolor main title in a plot. I would like to have 3/4 colors to help people in the audience to visually realize what is what in a 4x2 plot array On top of each plot I would like to have two lines. The 1st line will indicate what is plotted The 2nd line will indicate a a reference Graphically speaking I would like a result similar to this (simplified) one: par(mfrow=c(2,4)) for(aux in 1:4){ plot(1,1) mtext(1st treatm, cex=1, line=1.7, adj=0.1, col=1) mtext(2nd treatm, cex=1, line=1.7, adj=0.5, col=2) mtext(3rd treatm, cex=1, line=1.7, adj=0.9, col=3) mtext(1st treatm, line=0.6, adj=0.1, col=1) mtext(1st treatm, line=0.6, adj=0.5, col=1) mtext(1st treatm, line=0.6, adj=0.9, col=1) } for(aux in 1:4){ plot(2,2) mtext(1st treatm, cex=1, line=1.7, adj=0.1, col=1) mtext(2nd treatm, cex=1, line=1.7, adj=0.5, col=2) mtext(3rd treatm, cex=1, line=1.7, adj=0.9, col=3) mtext(2nd treatm, line=0.6, adj=0.1, col=2) mtext(2nd treatm, line=0.6, adj=0.5, col=2) mtext(2nd treatm, line=0.6, adj=0.9, col=2) } The code above does more or less what I want and I wrote it to simplify my explanation to you all. But what I really need is to put on top of each plot an entire string with color embedded into, so to say. A sort of 1st treatm 2nd treatm 3rd treatm string with informations able to colour the word 1st treatm in black, the word 2nd treatm in red and so on. I need this because I have my descriptions in a vector like c(1st treatm 2nd treatm 3rd treatm, 2nd treatm 3rd treatm 1st treatm, ...) What I have in mind is something similar to the latex code \color{black}{1st treatm} \color{red}{2nd treatm} \color{green}{3rd treatm} Which pages of the R manual should I have to read to solve my problem ? Thanks in advance -- Ottorino-Luca Pantani, Università di Firenze Dip.to di Scienze delle Produzioni Vegetali, del Suolo e dell'Ambiente Forestale (DiPSA) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Again on overlaying plots (a plot region within a plot region)
Dear R-users, after seeking for help in R-search I did not find any hint on my particular problem. Countless help on true overlay, but nothing on this. Please consider the following: par(mfrow = c(2, 1)) T - seq(0, 20, by = 0.01) ## PLOT 1 plot(T, 30*exp(-0.65*T), type = l ) points(T, 30*exp(-0.26 * T), type = l, lty = F8) points(T, 30*exp(-0.15 * T), type = l, lty = 39) ## PLOT 2 plot(T, 30*exp(-0.65*T), type = l, log= y ) points(T, 30*exp(-0.26 * T), type = l, lty = F8) points(T, 30*exp(-0.15 * T), type = l, lty = 39) What I would like to do is to draw a square plot of PLOT 1 and then overlay the *entire* PLOT 2 on the upper right corner of PLOT 1, when there's a lot of empty space I have to do that because the publisher asked me not to waste much space with figures. I studied for some time the Paul Murrell's excellent book R Graphics, but I did not find what I'm looking for. As far as I understand, layout() is intended to flexibly divide the plot region, not to subdivide the plot region nor the figure region. One solution could be to export PLOT 1 , say as png, and then overlay on it PLOT 2 with pixmap() as in this example http://www.stat.auckland.ac.nz/~paul/RGraphics/custombase-pixmap.R but it seems to me a bit too much complicate Thanks in advance for your time -- Ottorino-Luca Pantani, Università di Firenze Dip. Scienza del Suolo e Nutrizione della Pianta P.zle Cascine 28 50144 Firenze Italia Ubuntu 8.04.3 LTS -- GNU Emacs 23.0.60.1 (x86_64-pc-linux-gnu, GTK+ Version 2.12.9) ESS version 5.5 -- R 2.10.0 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] on gsub (simple, but not to me!) sintax
Dear R users, my problem today deals with my ignorance on regular expressions. a matter I recently discovered. Consider the following foo - c(V_7_101110_V, V_7_101110_V, V_9_101110_V, V_9_101110_V, V_9_s101110_V, V_9_101110_V, V_9_101110_V, V_11_101110_V, V_11_101110_V, V_11_101110_V, V_11_101110_V, V_11_101110_V, V_17_101110_V, V_17_101110_V) what I'm trying to obtain is to add a zero in front of numbers below 10, as in c(V_07_101110_V, V_07_101110_V, V_09_101110_V, V_09_101110_V, V_09_101110_V, V_09_101110_V, V_09_101110_V, V_11_101110_V, V_11_101110_V, V_11_101110_V, V_11_101110_V, V_11_101110_V, V_17_101110_V, V_17_101110_V) I'm able to do this on the emacs buffer through query-replace-regexp C-M-% search for V_\(.\)_ and substitute with V_0\1_ but I completely ignore how to do it with gsub within R and the help is quite complicate to understand (at least to me, at this moment in time) I can search the vector through grep(V_._, foo) but I always get errors either on gsub('V_\(.\)_', 'V_0\1_', foo) or I get not what I'm looking for on gsub('V_._', 'V_0._', foo) gsub('V_._', 'V_0\1_', foo) Thanks in advance -- Ottorino-Luca Pantani, Università di Firenze Dip. Scienza del Suolo e Nutrizione della Pianta P.zle Cascine 28 50144 Firenze Italia Ubuntu 8.04.3 LTS -- GNU Emacs 23.0.60.1 (x86_64-pc-linux-gnu, GTK+ Version 2.12.9) ESS version 5.5 -- R 2.10.0 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] on gsub (simple, but not to me!) sintax
Duncan Murdoch ha scritto: On 11/16/2009 8:21 AM, Ottorino-Luca Pantani wrote: Dear R users, my problem today deals with my ignorance on regular expressions. a matter I recently discovered. You were close. First, gsub by default doesn't need escapes before the parens. (There are lots of different conventions for regular expressions, unfortunately.) So the Emacs regular expression V_\(.\)_ is entered as V_(.)_ in the default version of gsub(). Second, to enter a backslash into a string, you need to escape it. So the replacement pattern V_0\1_ is entered as V_0\\1_. So gsub(V_(.)_, V_0\\1_, foo) should give you what you want. Duncan Murdoch Any of these (the need for doubling of the \\ for the back-reference seems to be the main issue: gsub(_([[:digit:]])_., _0\\1_, foo) gsub(_(\\d)_., _0\\1_, foo) gsub(V_(.)_, V_0\\1_, foo) David Winsemius, MD Heritage Laboratories West Hartford, CT I suspected something on the double escape.. Thanks to you all. R is a wonderful software and R-help is always a great place to visit !!! 8rino __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Rearranging long tables, Sweave, xtable, LaTeX
Dear R-users, consider the two following outputs, ## 1 and ## 2 \begin{Scode}{Setup, echo = FALSE, print = FALSE, eval = TRUE} with(expand.grid(Fact1 = 1:3, Fact2 = 1:40), table(Fact1, Fact2)) ## 1 xtable(with(expand.grid(Fact1 = 1:3, Fact2 = 1:40), table(Fact1, Fact2))) ## 2 \end{Scode} The first line with(expand.grid(Fact1 = 1:3, Fact2 = 1:40), table(Fact1, Fact2)) has an output that easily fit the A4 page, while the second produce an output that do not fit the A4 page. Is it possible to produce an output with xtable, but similar to the one of the first line ? In other words I do not want to use \longtables and the similar. Where should I look for info ? In Latex ? In Sweave ? In xtable ? Thanks a lot -- Ottorino-Luca Pantani, Università di Firenze Dip. Scienza del Suolo e Nutrizione della Pianta P.zle Cascine 28 50144 Firenze Italia Tel 39 055 3288 202 (348 lab) Fax 39 055 333 273 olpant...@unifi.it http://www4.unifi.it/dssnp/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Rearranging long tables, Sweave, xtable, LaTeX
Ista Zahn ha scritto: Yeah, I've had this kind of situation before. Usually I first see if I can fit it on the page by rotating it and/or reducing the size. If that doesn't do it then I'll re-arrange as you suggest. Basically the print method is just wrapping the output after n columns (27 in my case, but I think this depends on the options you have set). So you can do this wrapping yourself before calling xtable: tmp - with(expand.grid(Fact1 = 1:3, Fact2 = 1:40), table(Fact1, Fact2)) tmp2 - rbind(tmp[,1:20], tmp[,21:40]) xtable(tmp2) Hope it helps, Ista Thanks a lot, but still there are problems. My fault in the too simple code posted. Consider the following (tmp - with(expand.grid(Fact1 = 1:3, Fact2 = c(letters[1:20], LETTERS[1:20])), table(Fact1, Fact2)) Fact2 Fact1 a b c d e f g h i j k l m n o p q r s t A B C D E F G H I 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Fact2 Fact1 J K L M N O P Q R S T 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 From this table I can easily see, in the 1st row (Fact1) which are the observations for the minuscule as well for the MAJUSCULE while in (tmp2 - rbind(tmp[,1:20], tmp[,21:40])) a b c d e f g h i j k l m n o p q r s t 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 the infomation on the MAJUSCULE factor is completely missing (hided). __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] insert a text in panels, always in the same position (lattice, ltext, ?prepanel?)
Dear R-users, my present problem is related to lattice. I would like to put some text in each panel, namely a p-value. I therefore wrote a simple panel function as reported here below. I'm able to write the value in each panel at the maximum value of y for each panel, but this obviously overlay the text to the points. What I'm looking for is to write the text always in the same position along the panels, say in the middle of each panel something like ltext(x = 1.5, y = (ylim[2] - ylim[1])/2 ) I tried to play with ylim and prepanel but unsuccesfully. Thank a lot in advance # df - expand.grid(a = gl(3,1), b = gl(2,1), c = gl(2,1), d = gl(2,1), rep = gl(3,1)) df$x -rnorm(nrow(df)) df$x[c(1, 3, 25, 27, 49, 51)] - df$x[c(1, 3, 25, 27, 49, 51)] + 5 ## modify some values in order to have some significant values (1st and 3rd panel) my.panel - function (x, y, ...) { lm1 - lm(y ~ x) ## build the model p.value.diff - coef(summary(lm1))[2, 4]## extract the p-value panel.fill(col = ifelse(p.value.diff 0.05, lightgrey, transparent)) ## background color as function of p-value panel.xyplot(x, y) ## draw the points ## insert the p-value in each panel ltext(x = 1.1, y = max(y), ## the above is the problematic point. I tried also y = panel.default.xyplot(list(ylim[2])) but without success labels = paste(p, as.character(round(p.value.diff, 3)), sep = =)) } ## xyplot(x ~ d| a + b + c, data = df, layout = c(6, 2), strip = strip.custom(strip.names = TRUE, strip.levels =TRUE), panel = my.panel) -- Ottorino-Luca Pantani, Università di Firenze Dip. Scienza del Suolo e Nutrizione della Pianta P.zle Cascine 28 50144 Firenze Italia Ubuntu 8.04.3 LTS -- GNU Emacs 23.0.60.1 (x86_64-pc-linux-gnu, GTK+ Version 2.12.9) ESS version 5.5 -- R 2.9.2 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to properly shade the background panels of an xyplot?
Dear R users, this is a follow up of this message http://tolstoy.newcastle.edu.au/R/e6/help/09/05/13897.html I'm reproducing the core of it for convenience. // / data(Oats, package = MEMSS) / / tp1.oats - xyplot(yield ~ nitro | Variety + Block, / / data = Oats, / / panel = function(x, y, subscripts, ...) { / /# How to normalize my heatmap metric with / /# the value of the panel that has maximum average ? / /# metric = eval(mean(y)/ max(mean-of-each-panel) / /metric = eval(mean(y)/max(Oats$yield)) / /panel.fill(col = gray(metric)) / /panel.lines(x,y) / / } / /) / / print(tp1.oats) / // xyplot(yield ~ nitro | Variety + Block, data = Oats, max.mean = max(with(Oats, tapply(yield, list(Variety, Block), mean))), panel = function(x, y, subscripts, max.mean, ...) { metric = mean(y)/max.mean panel.fill(col = gray(metric)) panel.lines(x,y) }) or xyplot(yield ~ nitro | Variety + Block, data = Oats, aux.env = new.env(parent = emptyenv()), prepanel = function(x, y, aux.env, ...) { aux.env$max.mean.y - max(aux.env$max.mean.y, mean(y)) list() }, panel = function(x, y, subscripts, aux.env, ...) { metric = mean(y) / aux.env$max.mean.y panel.fill(col = gray(metric)) panel.lines(x,y) }) -Deepayan The result is a trellis object in which the background colour of the panels is an outcome of the data contained in the panel itself. After all, this is what panel = function (x,y . is meant for, right ? But what, if I want to highlight some panels ? Arbitrarily or conditioned by another variable. Say I want to shade in gray only the upper right panels (Block VI, Victory and Marvellous varieties ) Given a data frame like this, with a variable intended to set the colour of the panel background / data(Oats, package = MEMSS) /Oats1 - cbind.data.frame(Oats, Highlight = ifelse(Oats$Block == VI Oats$Variety %in% c(Victory, Marvellous ), gray, transparent) ) which is a possible code ? I (more or less) know how to manage the data in the panel, but I cannot imagine how to do it with variables external to the panel itself. I suppose that the panel functions are not useful here. I'm wandering through par.settings, themes and panel.fill, but still without success. Any hint ? -- Ottorino-Luca Pantani, Università di Firenze Dip. Scienza del Suolo e Nutrizione della Pianta P.zle Cascine 28 50144 Firenze Italia Ubuntu 8.04.3 LTS -- GNU Emacs 23.0.60.1 (x86_64-pc-linux-gnu, GTK+ Version 2.12.9) ESS version 5.5 -- R 2.9.2 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] dividing a dataframe column by different constants
Dear R users, today I've got the following problem. Here you are a dataframe as example. There are some SAMPLES for which a CONCentration was recorded through TIME. The time during which the concentration was recorded is not always the same, 10 points for Sample A, 7 points for Sample B and 11 for sample C Also the initial concentration was not the same for the three samples. I would like express the concentrations as % of the concentration at time = 1, therefore I wrote the following code that do the job, but is impractical when the samples are, as in my real case, more than on hundred. It is known that at the minimum time is present the maximum concentration, by which divide all the other concentrations in the sample. I'm quite sure that there's a more elegant solution, but I really do not even imagine how to write it. Thanks in advance for your time (df.mydata - data.frame( CONC = c(seq( from = 1, to = 0.1, by = -0.1 ), seq( from = 0.8, to = 0.2, by = -0.1 ), seq( from = 0.6, to = 0.1, by = -0.05 )), TIME = c(1:10, 2:8, 4:14 ), SAMPLE = c( rep( A, 10 ), rep( B, 7 ), rep( C, 11 ) ) ) ) MAX - tapply( df.mydata$CONC, df.mydata$SAMPLE, max ) (df.mydata$PERCENTAGE - ifelse(df.mydata$SAMPLE == A, df.mydata$CONC / MAX[1], ifelse(df.mydata$SAMPLE == B, df.mydata$CONC / MAX[2], df.mydata$CONC / MAX[3]))) -- Ottorino-Luca Pantani, Università di Firenze Dip. Scienza del Suolo e Nutrizione della Pianta P.zle Cascine 28 50144 Firenze Italia Tel 39 055 3288 202 (348 lab) Fax 39 055 333 273 olpant...@unifi.it http://www4.unifi.it/dssnp/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Book on R programming
ANJAN PURKAYASTHA ha scritto: Most books on R I come across describe running statistical procedures in R. Any suggestions on a good book that teaches *programming* in R? Thanks, Anjan Here there are a few http://www.r-project.org/doc/bib/R-books.html [42] and [79] may be good starting points -- Ottorino __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Select top three values from data frame
df.mydata[df.mydata$A==X AND df.mydata$C 2, ] will do the job ? 8rino Noah Silverman ha scritto: Hi, I'm trying to find an easy way to do this. I want to select the top three values of a specific column in a subset of rows in a data.frame. I'll demonstrate. ABC x21 x41 x32 y15 y26 y38 I want the top 3 values of B from the data.frame where A=X and C 2 I could extract all the rows where C2, then sort by B, then take the first 3. But that seems like the wrong way around, and it also will get messy with real data of over 100 columns. Any suggestions? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Select top three values from data frame
Noah Silverman ha scritto: I only have a few values in my example, but the real data set might have 20-100 rows with A=X. So how do I pick just the three highest ones? -N On 8/26/09 2:46 AM, Ottorino-Luca Pantani wrote: df.mydata[df.mydata$A==X AND df.mydata$C 2, ] will do the job ? 8rino Noah Silverman ha scritto: Hi, I'm trying to find an easy way to do this. I want to select the top three values of a specific column in a subset of rows in a data.frame. I'll demonstrate. ABC x21 x41 x32 y15 y26 y38 I want the top 3 values of B from the data.frame where A=X and C 2 I could extract all the rows where C2, then sort by B, then take the first 3. But that seems like the wrong way around, and it also will get messy with real data of over 100 columns. Any suggestions? my.data - cbind.data.frame(expand.grid(A = c(X, Y), B = 1:100), C = rnorm(100)) myA.data - my.data[my.data$A == X, ] myA.sorted.data - myA.data[order(myA.data$C, decreasing=TRUE), ][1:3.] Do this solve your problem ? -- Ottorino-Luca Pantani, Università di Firenze Dip. Scienza del Suolo e Nutrizione della Pianta P.zle Cascine 28 50144 Firenze Italia Tel 39 055 3288 202 (348 lab) Fax 39 055 333 273 olpant...@unifi.it http://www4.unifi.it/dssnp/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] natural sorting a data frame /vector by row
Moumita Das ha scritto: How to NATURAL sort a vector or data frame* by row* , in ascending order ? V1 V2V3 V4 i1 5.00e-01 1.036197e-17 4.825338e+16 0. i104.001692e-18 1.365740e-17 2.930053e-01 0.76973827 i12 -1.052843e-17 1.324484e-17 -7.949081e-01 0.42735000 i132.571236e-17 1.357336e-17 1.894325e+00 0.05922715 i2-5.630739e-18 1.638267e-17 -3.437010e-01 0.73133282 i3 4.291387e-18 1.207522e-17 3.553879e-01 0.72257050 i4 1.472662e-17 1.423051e-17 1.034863e+00 0.30163897 i5 5.00e-01 1.003323e-17 4.983441e+16 0. i6 5.147966e-18 1.569095e-17 3.280850e-01 0.74309614 i7 1.096044e-17 1.555829e-17 7.044760e-01 0.48173041 i8-1.166290e-18 1.287370e-17 -9.059482e-02 0.92788026 i9 1.627371e-17 1.540567e-17 1.056345e+00 0.29173427 recmeanC2 9.275880e-17 6.322780e-17 1.467057e+00 0.14349903 NA NANA NA recmeanC3 1.283534e-17 2.080644e-17 6.168929e-01 0.53781390 recmeanC4-3.079466e-17 2.565499e-17 -1.200338e+00 0.23103743 I want a sequence of rows as :-- *recmeanC2 ,recmeanC3,recmeanC4* and the *NA row in the third position from the top*(presently it's third from down) I do not understand what NATURAL stand for, but I'm not mothertongue in English. Is this the order you want ? recmeanC2 9.275880e-17 6.322780e-17 1.467057e+00 0.14349903 recmeanC3 1.283534e-17 2.080644e-17 6.168929e-01 0.53781390 recmeanC4-3.079466e-17 2.565499e-17 -1.200338e+00 0.23103743 NA NANA NA i1 5.00e-01 1.036197e-17 4.825338e+16 0. i2-5.630739e-18 1.638267e-17 -3.437010e-01 0.73133282 i3 4.291387e-18 1.207522e-17 3.553879e-01 0.72257050 i4 1.472662e-17 1.423051e-17 1.034863e+00 0.30163897 i5 5.00e-01 1.003323e-17 4.983441e+16 0. i6 5.147966e-18 1.569095e-17 3.280850e-01 0.74309614 i7 1.096044e-17 1.555829e-17 7.044760e-01 0.48173041 i8-1.166290e-18 1.287370e-17 -9.059482e-02 0.92788026 i9 1.627371e-17 1.540567e-17 1.056345e+00 0.29173427 i104.001692e-18 1.365740e-17 2.930053e-01 0.76973827 ***no i11 ? *** i12 -1.052843e-17 1.324484e-17 -7.949081e-01 0.42735000 i132.571236e-17 1.357336e-17 1.894325e+00 0.05922715 If so I'm afraid there's no a simple way to do it. This a possible solution df.newdata - cbind.data.frame(df.yourdata, foo=c(13, 15, 16, 17, 1, 2:12, 13:15) df.newdataOrdered - df.newdata[sort(df.newdata$foo),] another solution could be to rename the items in column 1 -- Ottorino __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] mild and extreme outliers in boxplot
Hi Jimmy, please be reassured that I did not intend to offend you nor any other in the list. Rnewbie ha scritto: I read the boxplot() help file and googled before making the post, and with my little knowledge on R I was not able to plot in the way I wanted. If I'm allowed, this was not evident from your post. Probably due to its conciseness, I thought it was in the style I have a problem, I do not want to study to solve it, need someone to do it for me I realize now it was not the case. I apologize for this. Ottorino That’s why I made the post. Whether I can eventually solve the problem or not, I appreciate very much any help. I’m a very beginner of R, and found the R help forum a couple of weeks ago. Since I thought I’m not among the major players of the forum and that the post per se rather than poster is of concern like in any other public online forum, I just registered with an arbitrarily chosen ID and kept using it. I’m not making use of R help for any commercial purposes whatsoever. I’m a master’s student working on my thesis. Thanks all for your help. Jimmy __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] mild and extreme outliers in boxplot
I'm very sorry for all this, but still serene. I'm (trying) to use R since may be 5 or 6 years now. What I learned from this list is that you have to show some code to let others to help you out, a thing that Rnewbye did not in this particular case. I had a look myself at the help pages and see that something was there that could help Rnewbye. In particular outlty, outlwd, outpch, outcex, outcol, outbg: outlier line type, line width, point character, point size expansion, color, and background color. The default 'outlty= blank' suppresses the lines and 'outpch=NA' suppresses points. My answer was somehow provocative, but I was ready to help, not to patronize (as many times I saw on this list). I tried myself to change the appearance of the circles and other aspect of the plot, uncorrectly assuming that it could be extended to the problem of Rnewbye. I surely made a mistake, and I apologize for this. This is is my only fault. BUT PLEASE do not forget that if Rnewbye answered to my post (with a piece of code for example) I would have helped him. As I was always helped, harshly or not. Ottorino This is the sort of response that gives R-help a bad name. I did not know that R-help had a bad name. I myself received sometimes some harsh answers, but never lamented about. Gabor Grothendieck ha scritto: I agree its not completely obvious from that answer but that does not mean the responder deserves to be attacked. The circle part is actually the default and albeit with difficulty the help files do give the info we need to produce this: bp - boxplot(c(1:50, 80, 100, 200), outpch = NA) with(bp, points(group, out, pch = c(1, 1, 8))) which can be suitably generalized for other situations. On Wed, Aug 19, 2009 at 8:31 PM, Rolf Turnerr.tur...@auckland.ac.nz wrote: I despair. .. -- Ottorino-Luca Pantani, Università di Firenze Dip. Scienza del Suolo e Nutrizione della Pianta P.zle Cascine 28 50144 Firenze Italia Tel 39 055 3288 202 (348 lab) Fax 39 055 333 273 olpant...@unifi.it http://www4.unifi.it/dssnp/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] [Fwd: Re: Several simple but hard tasks to do with R]
Rakknar ha scritto: Hello everybody. I've been learning R for about a month to do a econometric study and now i'm stuck with some problems to make R do the things I want. Here I give the list of things I wanna do from the most simple to the more complex (for me of course): 1. Make a log. I've been using Stata and there i have a great tool to register what the program do: the log file, wich it's a simple .txt file where Stata writes every output it makes (not graphics of course). When I wanted to make the same thing with R I started to use the function sink() but it only register the results of the commands (summaries for example) and not the commands itself, witch it's really uncomfortable because it's harder to find out to witch command that results come from. 2. Saving objects in a .Rdata step by step. I want to save several regressions of interest in one .Rdata file. I want to save this results one by one. For example: make regression 1, save the result in the .Rdata file; then make the regression 2 and save the results in the same .Rdata file. I know I could make all the regressions and save the results all at once but for the kind of study I want to make It would be much useful this way. I've been using function save() but I only could save one result or all. As far as I can understand, you are running the commands from the command line, right ? I did this at the very beginning, but then I realize that are better way of dealing with R, that is let R do the calculations and other software do the editing of the scripts, saving data, code and so on. Consider the use of emacs + ESS + R. http://ess.r-project.org/ This will complicate things a little more, (A LOT !) but you will not regret the time spent in learning. Emacs will be useful in MANY other ways. -- Ottorino-Luca Pantani, Università di Firenze Dip. Scienza del Suolo e Nutrizione della Pianta P.zle Cascine 28 50144 Firenze Italia Tel 39 055 3288 202 (348 lab) Fax 39 055 333 273 olpant...@unifi.it http://www4.unifi.it/dssnp/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Several simple but hard tasks to do with R
Rakknar ha scritto: 1. Make a log. I've been using Stata and there i have a great tool to register what the program do: the log file, wich it's a simple .txt file where Stata writes every output it makes (not graphics of course). When I wanted to make the same thing with R I started to use the function sink() but it only register the results of the commands (summaries for example) and not the commands itself, witch it's really uncomfortable because it's harder to find out to witch command that results come from. A possible workaround could be: sink(ouputfile.txt) as.character(rnorm(5, mean = 0, sd = 1)) rnorm(5, mean = 0, sd = 1) sink() I know, it is not elegant, and a bit repetitive, but it could help. 8rino __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to Transpose a dataset
rajclinasia ha scritto: Hi everyone, How to a transpose a R dataset with a specified variable. If possible send the code. it will be very helpful for us. Thanks in Advance. A written code of your problem would be useful for us to help you. If you have a dataframe you may want to take a look also at ?stack ?reshape -- Ottorino-Luca Pantani, Università di Firenze Dip. Scienza del Suolo e Nutrizione della Pianta P.zle Cascine 28 50144 Firenze Italia Tel 39 055 3288 202 (348 lab) Fax 39 055 333 273 olpant...@unifi.it http://www4.unifi.it/dssnp/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] mild and extreme outliers in boxplot
Rnewbie ha scritto: dear all, could somebody tell me how I can plot mild outliers as a circle(°) and extreme outliers as an asterisk(*) in a box-whisker plot? Thanks very much in advance ?boxplot or help(bxp) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] edit.row.names taking row names from the edited dataframe
Erik Iverson ha scritto: This really has nothing to do with the row names issue you mention, as far as I can tell. It has to do with this: http://stackoverflow.com/questions/1195826/dropping-factor-levels-in-a-subsetted-data-frame-in-r Best, Erik Iverson Perhaps you may also take a look at this http://wiki.r-project.org/rwiki/doku.php?id=tips:data-manip:drop_unused_levels df.mydata$problemFactor - df.mydata$problemFactor[, drop = TRUE] 8rino __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] visualizzazione colonne
sabrina.michie...@alice.it ha scritto: ciao, ho aperto un file in R di classe data frame di 15000 righe e 29 colonne. Nella console però sono visualizzate solo la prima e l'ultima colonna e le ultime 8000 righe circa. E' possibile una visualizzazione completa? Grazie Sabrina Hi Sabrina, please do not forget that this list in english. Remember it for the future. I find very inconvenient to have all the rows displayed at one time, especially if they are 15000 !!! Should I need to look at all the dataset I would use page(mydataframe) (emacs or xemacs + ESS needed) or from the console fix(mydatframe) very dangerous !!! or edit (mydataframe) Before attempting this, read the help ?edit ?fix Should you want to look at only some part of the dataframe, try for example mydataframe[3:15, 7:8] This will show you the data contained lines from line 3 to 15 and in column from 7 to 8. Ciao -- Ottorino-Luca Pantani, Università di Firenze __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to compute other columns without a column for sample name
sandsky ha scritto: Data has the first row for variable name and the first column for sample name. I want to take Log for all data, but how to compute without the first column for sample name. log.raw_data=log(raw_data,base=2) Error in Math.data.frame(list(sample_id = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, : non-numeric variable in data frame: sample_id Thank you in advance, Jin You are trying to calculate a logarithm for a character variable. You most probably imported the data with read.table (header = FALSE). try sapply(raw_data, is.numeric) to see which are the columns that contains logarithmizable items 8rino __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [Fwd: Re: R code to reproduce (while studying) Bates Watts 1988]]]
Douglas Bates ha scritto: I have been without Internet access for a couple of weeks (in the US ATT is now competing with the cable companies and has succeeded in emulating the cable TV companies' terrible service) and I missed the beginning of this discussion. Is there a reason that you have not used the example in the NRAIA package to obtain that model fit? A quite simple reason. My fault: I did not know the existence of the library, so I was trying to build the example (and the data set) on my own. Try install.packages(NRAIA) library(NRAIA) example(Chloride) That gets you the data and the model fit without the AR1 correlation. I guess that I didn't put in the general optimization in that example yet. Could you be please so kind to give me some hints on it ? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] [Fwd: Re: R code to reproduce (while studying) Bates Watts 1988]]]
Kevin Wright wrote: library(nlme) m2 - gnls(conc ~ t1*(1-t2*exp(-k*time)), data = df.Chloride, start = list( t1 = 35, t2 = 0.91, k = 0.22)) So my error was to use nls instead that gnls. Thanks a lot, Kevin. summary(m2) plot(m2) lag.plot(resid(m2), do.lines=FALSE) acf(resid(m2)) m3 - update(m2, corr=corAR1(.67)) summary(m3) plot(m3) lag.plot(resid(m3), do.lines=FALSE) acf(resid(m3)) The residual plots for model m3 still show structure, unlike in Bates Watts, so maybe this is not the correct model? Kevin Actually is not even the same model described in the book. There the model is told to have the following parameters; t1 37.58 t20.849 k 0.178 Phi 0.69, while the one obtained with R has the following t1 38.98 t2 0.825 k 0.158 Phi 0.682. I run this code, but without success. I obtain again the m3 model. m4 - gnls(conc ~ t1*(1-t2*exp(-k*time)), data = df.Chloride, start = list( t1 = 37.58, t2 = 0.849, k = 0.178), corr=corAR1(.69)) I cannot understand why anova(m2, m3) Model df AIC BIC logLik Test L.Ratio p-value m2 1 4 -20.09053 -12.13459 14.04526 m3 2 5 -51.08761 -41.14269 30.54380 1 vs 2 32.99708 .0001 indicate a susbstantial improvement in the model, but the plot of residual is quite the same (slight differences) plot(m2, pch = 20);x11();plot(m3, pch = 20) Any other idea ? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Rounding to the nearest 5
Steve Murray ha scritto: Dear all, A hopefully simple question: how do I round a series of values (held in an object) to the nearest 5? I've checked out trunc, round, floor and ceiling, but these appear to be more tailored towards rounding decimal places. Thanks, Steve I had a similar problem in the past Take a look at http://tolstoy.newcastle.edu.au/R/e4/help/08/05/11017.html and to the replies -- Ottorino-Luca Pantani, Università di Firenze Dip. Scienza del Suolo e Nutrizione della Pianta P.zle Cascine 28 50144 Firenze Italia Tel 39 055 3288 202 (348 lab) Fax 39 055 333 273 olpant...@unifi.it http://www4.unifi.it/dssnp/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R code to reproduce (while studying) Bates Watts 1988
Hi R users, I'm here trying to understand correlated residuals in nonlinear estimation. I'm reading/studying the book Bates, D. M. and D. G. Watts, (1988), /Nonlinear regression analysis and its applications/, Wiley, NY. pages 92-94, trying to reproduce the figures and to find out the code in R to perform the necessary calculations. I also consulted Pinheiro and Bates, but without success Here below you'll find are my efforts. I'm in trouble at plotting the lag plot (fig 3.6 b) and in fitting the new model with autocorrelated residuals (most probably misusing correlation = corAR1() in updating a nls model). Could someone be so kind to help me ? Thanks a lot Ottorino df.Chloride- structure(.Data = list(time = c(2.45, 2.55, 2.65, 2.75, 2.85, 2.95, 3.05, 3.15, 3.25, 3.35, 3.45, 3.55, 3.65, 3.75, 3.85, 3.95, 4.05, 4.15, 4.25, 4.35, 4.45, 4.55, 4.65, 4.75, 4.85, 4.95, 5.05, 5.15, 5.25, 5.35, 5.45, 5.55, 5.65, 5.75, 5.85, 5.95, 6.05, 6.15, 6.25, 6.35, 6.45, 6.55, 6.65, 6.75, 6.85, 6.95, 7.05, 7.15, 7.25, 7.35, 7.45, 7.55, 7.65, 7.75), conc = c( 17.3, 17.6, 17.9, 18.3, 18.5, 18.9, 19, 19.3, 19.8, 19.9, 20.2, 20.5, 20.6, 21.1, 21.5, 21.9, 22, 22.3, 22.6, 22.8, 23, 23.2, 23.4, 23.7, 24, 24.2, 24.5, 25, 25.4, 25.5, 25.9, 25.9, 26.3, 26.2, 26.5, 26.5, 26.6, 27, 27, 27, 27, 27.3, 27.8, 28.1, 28.1, 28.1, 28.4, 28.6, 29, 29.2, 29.3, 29.4, 29.4, 29.4)), row.names = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54), class = data.frame, reference = A1.9, p. 274) ##Figure 3.5, pag 92 plot(df.Chloride$time, df.Chloride$conc, pch = 20) ## fitting the model nls.1 - nls(conc ~ t1*(1-t2*exp(-k*time)), data = df.Chloride, start = list( t1 = 35, t2 = 0.91, k = 0.22)) ##Figure 3.56a, pag 93 plot(nls.1, pch = 20) ##Figure 3.56b, pag 93 ???not the foggiest idea ##Figure 3.57, pag 94 acf(resid(nls.1), xlim = c(1, 15), lab = c(5, 4, 7)) ##Try to fit a model with autocorrelated residues (Problems !!) nls.2 - update(nls.1, corr = corAR1(0.67)) -- Ottorino-Luca Pantani, Università di Firenze Dip. Scienza del Suolo e Nutrizione della Pianta P.zle Cascine 28 50144 Firenze Italia Tel 39 055 3288 202 (348 lab) Fax 39 055 333 273 olpant...@unifi.it http://www4.unifi.it/dssnp/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Is there in R a function equivalent to the mround, as found in most spreadsheets?
Dear R-users, I have the following problem In a lab experiment I have to mix three solutions to get different concentrations of various molecules in a cuvette I've used R to calculate the necessary µliters for each of the level of the experiment and I must confess that it is more useful and easier to achieve the results than using spreadsheets. But there's a problem. Imagine that for a particular cuvette (I have 112 different cuvettes !!) you have to mix the following volumes of solution A, B, and C respectively. c(1803.02, 193.51, 3.47) Each solution is to be taken with 3 different pipettes (5000, 250 and 10 µL Volume max) and each of those delivers volumes in steps of 50 µL, 5 µL or 1µL, respectively Since the above values would eventually become c(1800, 195, 3) it is then necessary to recalculate all the final concentrations of A, B and C, because the volumes are changed. I know that in most spreadsheets (Calc, Gnumeric, Excel and so on) there's a function such as mround(num; num) that give the results I need, but I want to learn more on R functions. I played a little with R functions such as round, signif, ceiling, trunc, and floor but without success. Any hint to solve this problem ? Thanks a lot http://www.openofficetips.com/blog/archives/2005/04/rounding_to_the.html http://www.gnome.org/projects/gnumeric/doc/gnumeric-MROUND.shtml -- Ottorino-Luca Pantani, Università di Firenze Dip. Scienza del Suolo e Nutrizione della Pianta P.zle Cascine 28 50144 Firenze Italia Tel 39 055 3288 202 (348 lab) Fax 39 055 333 273 [EMAIL PROTECTED] http://www4.unifi.it/dssnp/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Is there in R a function equivalent to the mround, as found in most spreadsheets?
Charilaos Skiadas ha scritto: On May 9, 2008, at 5:39 AM, Dieter Menne wrote: If I understand the OP's question properly, the first value is to be a multiple of 50, the second a multiple of 5, and the third a multiple of 1. This can be done with this slight variation on the above theme: a - c(1803.02, 193.51, 3.47) b - c(50,5,1) round(a/b) *b This is exactly was I was looking for, and you understand it properly. Sorry for the double post, but I'm experiencing problems with my account in this list This is not exactly what you want, but it shows that the problem is a bit ill-defined. In the example you gave, why do you want 1800, and not 1805, which is possible with the pipettes? I assume that you laboratory experience is working in the background, telling you to stop pipetmanning when you are close to the result in some percentage feeling. Dieter No, even if there's a lab background working behind, I'm only transferring some experience with spreadsheets to R. I want (actually the pipette wants) 1800 instead that 1805 since the larger volumes are to be delivered with a digital pipette whose step is 50. Thanks to all the people who contributed. This list is always a great source. 8rino __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Is there in R a function equivalent to the mround, as found in most spreadsheets?
Dear R-users, I have the following problem In a lab experiment I have to mix three solutions to get different concentrations of various molecules in a cuvette I've used R to calculate the necessary µliters for each of the level of the experiment and I must confess that it is more useful and easier to achieve the results than using spreadsheets. But there's a problem. Imagine that for a particular cuvette (I have 112 different cuvettes !!) you have to mix the following volumes of solution A, B, and C respectively. c(1803.02, 193.51, 3.47) Each solution is to be taken with 3 different pipettes (5000, 250 and 10 µL Volume max) and each of those delivers volumes in steps of 50 µL, 5 µL or 1µL, respectively Since the above values would eventually become c(1800, 195, 3) it is then necessary to recalculate all the final concentrations of A, B and C, because the volumes are changed. I know that in most spreadsheets (Calc in Open Office, Gnumeric, Excel and so on) there's a function such as mround(num; num) that give the results I need, but I want to learn more on R functions. I played a little with R functions such as round, signif, ceiling, trunc, and floor but without success. Any hint to solve this problem ? Thanks a lot http://www.openofficetips.com/blog/archives/2005/04/rounding_to_the.html http://www.gnome.org/projects/gnumeric/doc/gnumeric-MROUND.shtml -- Ottorino-Luca Pantani, Università di Firenze Dip. Scienza del Suolo e Nutrizione della Pianta P.zle Cascine 28 50144 Firenze Italia Tel 39 055 3288 202 (348 lab) Fax 39 055 333 273 [EMAIL PROTECTED] http://www4.unifi.it/dssnp/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] on trellis.par.set/get (reproducing figures from Pinheiro Bates)
Deepayan Sarkar ha scritto: On 1/29/08, Dr. Ottorino-Luca Pantani [EMAIL PROTECTED] wrote: Dear R users, I would like to exactly reproduce a figure like the 1.5 or 1.9 or 4.13 from the book Mixed effects models in S and S-Plus. Not for the sake of it, but because I have my own data I would like to plot in that fashion (no colors) If I write plot(ergoStool) I can get a good informative plot with colors, but I would like to have a BW one instead. Have you tried trellis.device(color = FALSE) plot(ergoStool) -Deepayan Thanks once more for your help. It works but the symbols are not the same as reported in the book. Now, if I can push your patience a little further, how can I change the plot symbols ? -- Ottorino __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] on trellis.par.set/get (reproducing figures from Pinheiro Bates)
Dear R users, I would like to exactly reproduce a figure like the 1.5 or 1.9 or 4.13 from the book Mixed effects models in S and S-Plus. Not for the sake of it, but because I have my own data I would like to plot in that fashion (no colors) If I write plot(ergoStool) I can get a good informative plot with colors, but I would like to have a BW one instead. I've played a little with trellis.par.set managing to change some aspect of the appearance of the plot, for example with prove.theme- list( dot.line = list(col = 1, lty = 3, lwd = 1), fontsize = list(text = 12, points = 10) ) trellis.par.set(prove.theme) plot(ergoStool) I also queried trellis.par.get by names(trellis.par.get()) but still I'm not able to figure out which are the parameters, if any, that control pch and col of the symbols. Any help is highly appreciated. -- Ottorino-Luca Pantani, Università di Firenze Dip. Scienza del Suolo e Nutrizione della Pianta P.zle Cascine 28 50144 Firenze Italia Tel 39 055 3288 202 (348 lab) Fax 39 055 333 273 [EMAIL PROTECTED] http://www4.unifi.it/dssnp/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Why I cannot get the intervals from Rails data ?
Dear R users, I would like to know where I'm wrong doing the following. lmList(Rail) is working fine, since it gives back the ouput. But on intervals(lmList(Rail)) I'm getting the following error Errore in out[, est., ] - coeff[, Estimate, ] : numero di indici non corretto that translated should sounds like Error in out[, est., ] - coeff[, Estimate, ] : not correct indexes number What is that I'm not considering here ? Thanks -- Ottorino-Luca Pantani, Università di Firenze Dip. Scienza del Suolo e Nutrizione della Pianta P.zle Cascine 28 50144 Firenze Italia Tel 39 055 3288 202 (348 lab) Fax 39 055 333 273 [EMAIL PROTECTED] http://www4.unifi.it/dssnp/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.