Re: [R] How to remove latex message from a resulting rmarkdown pdf?
On 03.08.2014 02:58, Eduardo M. A. M.Mendes wrote: Hello I am using rmarkdown to write the partial results of my research project. Both html and pdf files are used. In the resulting pdf xtable writes the following msg: % latex table generated in R 3.1.1 by xtable 1.7-3 package % Sat Aug 2 21:42:16 2014 How can I remove such a msg? Read ?print.xtable, there is some argument (comment?) to switch it off. Best, Uwe Ligges Many thanks Ed Below you will find the info on my system and a rmakrdown example to reproduce the msg. R version 3.1.1 (2014-07-10) Platform: x86_64-apple-darwin13.1.0 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 loaded via a namespace (and not attached): [1] cluster_1.15.2 [2] colorspace_1.2-4 [3] digest_0.6.4 [4] evaluate_0.5.5 [5] formatR_0.10 [6] gtable_0.1.2 [7] htmltools_0.2.4 [8] knitr_1.6 [9] labeling_0.2 [10] latticeExtra_0.6-26 [11] MASS_7.3-33 [12] munsell_0.4.2 [13] plyr_1.8.1 [14] proto_0.3-10 [15] RColorBrewer_1.0-5 [16] Rcpp_0.11.2 [17] reshape2_1.4 [18] rmarkdown_0.2.53 [19] scales_0.2.4 [20] stringr_0.6.2 [21] tools_3.1.1 [22] yaml_2.1.13 RStudio - Version 0.98.987 and ExampleA.Rmd --- title: Example - Latex message on the resulting pdf output: pdf_document --- ```{r r princ, echo=FALSE, warning=FALSE, results='asis', message=FALSE} library(xtable,quietly = TRUE,warn.conflicts = FALSE, verbose = FALSE) exampleAinfo=data.frame(matrix(runif(84),21,4)) names(exampleAinfo)=c(Column 1,Column 2,Column 3,Column 4) ``` # Example ```{r exampleA, results='asis', echo=FALSE, tidy=FALSE} exampleAinfo.table - xtable(exampleAinfo, caption=Example A, digits=6) print(exampleAinfo.table, include.rownames = FALSE, floating=FALSE) ``` [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Extract particular months from List in R
On 03.08.2014 07:17, Zilefac Elvis wrote: Hi ALL, I have a List object in R. The dataframes in the List have equal rows and columns. How can I extract from the List, data corresponding to say c(June, July , August)? Remember, it is a List object, containing 100 dataframes, with daily data arranged by YYMMDD. Thanks for your thoughtful solutions. An example would be helpful. Is the date column a Date, some POSIX.. object, or just a string or numeric value? In principle: write a function that extracts data for these months from one data.frame and then lapply() it to the list. Given you had provided a small example, we could have given you some more specific answer. Best, Uwe Ligges AT. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to overlay contourplot of a dataset A and a levelplot of a dataset B?
Dear all, Just to inform that I have solved my problem in a very elegant way, thanks to the layer approach given by package latticeExtra. After loading my grids like before: x-1:10 y-1:10 grid1-expand.grid(x=x,y=y) grid2-expand.grid(x=x,y=y) z1-grid1$x^2 + grid1$y^2 z2-2*grid2$x^2 - grid2$y^2 grid1$z-z1 grid2$z-z2 I just need to do: levelplot(z ~ x*y,grid2) + as.layer(contourplot(z ~ x*y,grid1)); The result is a beautiful plot with a contourplot over a levelplot. There are some examples of overlay of trellis plots in the manual of latticeExtra: http://latticeextra.r-forge.r-project.org/ Thank you for your attention, Best, Charles On Sat, Aug 2, 2014 at 4:01 PM, Charles Novaes de Santana charles.sant...@gmail.com wrote: Dear all, Does anyone know a way to overlay a contourplot and a levelplot of different datasets, both datasets with the same dimension? Let's say I have 2 10x10 grids, like those below: library(lattice) x-1:10 y-1:10 grid1-expand.grid(x=x,y=y) grid2-expand.grid(x=x,y=y) z1-grid1$x^2 + grid1$y^2 z2-2*grid2$x^2 - grid2$y^2 grid1$z-z1 grid2$z-z2 I would like to plot z1 and z2 in the same plot: z1 as a contourline and z2 as a levelplot. I tried to do this in two ways, without success: plot.new(); contourplot(z ~ x*y,grid1) par(new=T) levelplot(z ~ x*y,grid2) and levelplot(z ~ x*y,grid1,region=FALSE,contour=TRUE) par(new=T) levelplot(z ~ x*y,grid2,region=TRUE,contour=FALSE) Any clue? Thank you very much for your time and any help! Charles -- Um axé! :) -- Charles Novaes de Santana, PhD http://www.imedea.uib-csic.es/~charles -- Um axé! :) -- Charles Novaes de Santana, PhD http://www.imedea.uib-csic.es/~charles [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to remove latex message from a resulting rmarkdown pdf?
Many thanks. I was checking print options instead of print.xtable. Ed On Aug 3, 2014, at 4:44 AM, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 03.08.2014 02:58, Eduardo M. A. M.Mendes wrote: Hello I am using rmarkdown to write the partial results of my research project. Both html and pdf files are used. In the resulting pdf xtable writes the following msg: % latex table generated in R 3.1.1 by xtable 1.7-3 package % Sat Aug 2 21:42:16 2014 How can I remove such a msg? Read ?print.xtable, there is some argument (comment?) to switch it off. Best, Uwe Ligges Many thanks Ed Below you will find the info on my system and a rmakrdown example to reproduce the msg. R version 3.1.1 (2014-07-10) Platform: x86_64-apple-darwin13.1.0 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 loaded via a namespace (and not attached): [1] cluster_1.15.2 [2] colorspace_1.2-4 [3] digest_0.6.4 [4] evaluate_0.5.5 [5] formatR_0.10 [6] gtable_0.1.2 [7] htmltools_0.2.4 [8] knitr_1.6 [9] labeling_0.2 [10] latticeExtra_0.6-26 [11] MASS_7.3-33 [12] munsell_0.4.2 [13] plyr_1.8.1 [14] proto_0.3-10 [15] RColorBrewer_1.0-5 [16] Rcpp_0.11.2 [17] reshape2_1.4 [18] rmarkdown_0.2.53 [19] scales_0.2.4 [20] stringr_0.6.2 [21] tools_3.1.1 [22] yaml_2.1.13 RStudio - Version 0.98.987 and ExampleA.Rmd --- title: Example - Latex message on the resulting pdf output: pdf_document --- ```{r r princ, echo=FALSE, warning=FALSE, results='asis', message=FALSE} library(xtable,quietly = TRUE,warn.conflicts = FALSE, verbose = FALSE) exampleAinfo=data.frame(matrix(runif(84),21,4)) names(exampleAinfo)=c(Column 1,Column 2,Column 3,Column 4) ``` # Example ```{r exampleA, results='asis', echo=FALSE, tidy=FALSE} exampleAinfo.table - xtable(exampleAinfo, caption=Example A, digits=6) print(exampleAinfo.table, include.rownames = FALSE, floating=FALSE) ``` [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Rmarkdown Installation error on Shiny server , CentOS 6.4 x64
Hi , I am having difficulty installation rmarkdown on the centos shiny server. Can anyone help? Thanks! devtools::install_github(rstudio/rmarkdown) Installing github repo rmarkdown/master from rstudio Downloading master.zip from https://github.com/rstudio/rmarkdown/archive/master. zip Installing package from /tmp/Rtmp5i4HDt/master.zip arguments 'minimized' and 'invisible' are for Windows only Error: Does not appear to be an R package (no DESCRIPTION) version _ platform x86_64-redhat-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 3 minor 1.0 year 2014 month 04 day10 svn rev65387 language R version.string R version 3.1.0 (2014-04-10) nickname Spring Dance Regards Billy [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] lattice, latticeExtra: Adding moving averages to double y plot
Hi Anna I got down to plot2_3_concentration - xyplot(Value ~ Year, datamystuff23, groups = Type, ... and got an error: Error in eval(substitute(groups), data, environment(x)) : object 'datamystuff23' not found so I did not pursue further Note : from ?doubleYScale Note that most settings, like main/sub/legend/etc are taken only from obj1; only the panel, axis and ylab are taken from obj2. As we are now working with 2 plots you can reduce the complexity of your plots and you may get away without having to use a panel function. Try without a panel function and then a panel function. You may then get away with a panel.xyplot in the panel without having to resort to panel.groups. Settings for the key are those found in the trellis.par.get()$superpose. ... series ie. trellis.par.get()$superpose.line, trellis.par.get()$superpose.symbol etc You can setup par.settings adding superpose.symbol = list(...), superpose.line = list( ...) or what I have done key = list(text = list(label = c(stuff1,stuff2,stuff3)), lines = list(col = 1:3), cex = 0.8, title = stuff type, cex.title = 0.9, space = bottom), col = c(1:3) # for points ) and modify accordingly. I usually find it is easier to have a custom key as I have to make changes to various parts of the key and it is easier to add on things there. Duncan -Original Message- From: Anna Zakrisson Braeunlich [mailto:anna.zakris...@su.se] Sent: Sunday, 3 August 2014 15:10 To: Duncan Mackay Subject: RE: [R] lattice, latticeExtra: Adding moving averages to double y plot Hi Duncan, I think you have misunderstood my plot. I am able to change lty the way you have plotted it with points on one axis and moving averages on the other. if you run the code below, you find the plot that I need to do. data points and moving averages for factor 1 on one yaxis (temperature) and factor 2 and 3 (data points and moving averages on the second y-axis: summer and winter concentrations of compound X). See the plot below to better see what I mean. 1. My problem is to change lty for the axis where I have temperature. I somehow need to specify that lty is depending on factor, which I am not able to do. I have marked the position in plot2_3 where I have a problem. 2. The second issue is the symbols (pch). I have managed to change these in the plot, but cannot make them appear in the legend. How would I go about this? See comments in script. Below is the full script with a correct plot with the issues at hand labelled. many thank's for your time! Anna # mydata- data.frame( Year = 1980:2009, Type = factor(rep(c(stuff1, stuff2, stuff3), each = 10*3)), Value = rnorm(90, mean = seq(90), sd = rep(c(6, 7, 3), each = 10))) # stuff1 is temperature # stuff 2 and stuff 3 are concentration measurements of compound X library(lattice) library(latticeExtra) stuff1data - mydata[(mydata$Type) %in% c(stuff1), ] stuff2_3data - mydata[(mydata$Type) %in% c(stuff2, stuff3), ] # make moving averages function using zoo and rollmean: library(zoo) library(plyr) f - function(d) { require(zoo) data.frame(Year = d$Year[5:length(d$Year)], mavg = rollmean(d$Value, 5)) } # Apply the function to each group as well as both data frames: madfStuff1 - ddply(stuff1data, Type, f) madfStuff2_3 - ddply(stuff2_3data, Type, f) # combine averages into mydata mydata$mavg - c(rep(NA,4), madfStuff1[,3], rep(NA,4), subset(madfStuff2_3, Type== stuff2,3, drop = T), rep(NA,4), subset(madfStuff2_3, Type== stuff3,3, drop = T)) table(mydata$Type) # split stuff1 from stuff2/3 as they will read off different y-axes stuff1mavg_points - mydata[(mydata$Type) %in% c(stuff1), ] #temperature stuff23mavg_points - mydata[(mydata$Type) %in% c(stuff2, stuff3), ] # concentration # plot stuff2/3 with data points and moving averages reading off y-axis 1: plot2_3_concentration - xyplot(Value ~ Year, datamystuff23, groups = Type, allow.multiple = T, distribute.type = TRUE, par.settings = list(layout.heights = list(key.top = 1.5)), col = black, pch=c(2,15), ylab=concentration, subscripts = TRUE, panel = panel.superpose, panel.groups = function(x, y, subscripts, ...,group.number) { panel.xyplot(x, y, ...) panel.xyplot(x, datamystuff23[subscripts,mavg], type = l, col=black, lty = c(1:2)) # HERE IS THE PROBLEM! LTY!!! }) plot2_3_concentration # If I use l lty = c(1:2)[group.number], I get only one line! # plot stuff 1: with data points and moving averages reading off y-axis 2 plot1_temperature- xyplot(Value ~ Year,
Re: [R] Rmarkdown Installation error on Shiny server , CentOS 6.4 x64
When working on the bleeding edge (which github usually implies) it can be crucial to stay up to date. You might try updating R (your example seems to be working for me on R3.1.1 on Ubuntu 14.04). You should also cc the maintainer of contributed packages (?maintainer). Finally, you should read the Posting Guide, which points out that this is a plain text mailing list (HTML is not a what-you-see-is-what-we-see format). --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. On August 3, 2014 6:57:35 AM PDT, billy am wickedpu...@gmail.com wrote: Hi , I am having difficulty installation rmarkdown on the centos shiny server. Can anyone help? Thanks! devtools::install_github(rstudio/rmarkdown) Installing github repo rmarkdown/master from rstudio Downloading master.zip from https://github.com/rstudio/rmarkdown/archive/master. zip Installing package from /tmp/Rtmp5i4HDt/master.zip arguments 'minimized' and 'invisible' are for Windows only Error: Does not appear to be an R package (no DESCRIPTION) version _ platform x86_64-redhat-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 3 minor 1.0 year 2014 month 04 day10 svn rev65387 language R version.string R version 3.1.0 (2014-04-10) nickname Spring Dance Regards Billy [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Reading specific rows and columns xlsx file: Error in strsplit(names(res), \\.) : non-character argument
Hi, I am trying to read specific rows and columns from a xlsx file using the following commands: # Read rows 18-23 and columns 7-15 into R and assign the result to a variable # called dat colIndex - 18:23 rowIndex - 7:15 dat - read.xlsx(./data/natural_gas.xlsx, sheetIndex = 1, header = TRUE, colIndex = colIndex, rowIndex = rowIndex) But I get this error: Error in strsplit(names(res), \\.) : non-character argument I don't understand where that non-character comes from. When I read the whole file with: naturalGas - read.xlsx(./data/natural_gas.xlsx, sheetIndex = 1, header = TRUE) I don't get any problem. Should you be willing to try to reproduce this behavior, the file comes from: https://d396qusza40orc.cloudfront.net/getdata%2Fdata%2FDATA.gov_NGAP.xlsx sessionInfo()R version 3.1.1 (2014-07-10) Platform: x86_64-pc-linux-gnu (64-bit) I'm on debian Jessie. Disclaimer: this is a homework. Thank you in advance -- Best regards, Dr. Margherita DI LEO Scientific / technical project officer European Commission - DG JRC Institute for Environment and Sustainability (IES) Via Fermi, 2749 I-21027 Ispra (VA) - Italy - TP 261 Tel. +39 0332 78 3600 margherita.di-...@jrc.ec.europa.eu Disclaimer: The views expressed are purely those of the writer and may not in any circumstance be regarded as stating an official position of the European Commission. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Reading specific rows and columns xlsx file: Error in strsplit(names(res), \\.) : non-character argument
Ahem.. solved. I had switched between rows and columns.. Sorry for the noise. Best, m On Sun, Aug 3, 2014 at 6:33 PM, Margherita Di Leo direg...@gmail.com wrote: Hi, I am trying to read specific rows and columns from a xlsx file using the following commands: # Read rows 18-23 and columns 7-15 into R and assign the result to a variable # called dat colIndex - 18:23 rowIndex - 7:15 dat - read.xlsx(./data/natural_gas.xlsx, sheetIndex = 1, header = TRUE, colIndex = colIndex, rowIndex = rowIndex) But I get this error: Error in strsplit(names(res), \\.) : non-character argument I don't understand where that non-character comes from. When I read the whole file with: naturalGas - read.xlsx(./data/natural_gas.xlsx, sheetIndex = 1, header = TRUE) I don't get any problem. Should you be willing to try to reproduce this behavior, the file comes from: https://d396qusza40orc.cloudfront.net/getdata%2Fdata%2FDATA.gov_NGAP.xlsx sessionInfo()R version 3.1.1 (2014-07-10) Platform: x86_64-pc-linux-gnu (64-bit) I'm on debian Jessie. Disclaimer: this is a homework. Thank you in advance -- Best regards, Dr. Margherita DI LEO Scientific / technical project officer European Commission - DG JRC Institute for Environment and Sustainability (IES) Via Fermi, 2749 I-21027 Ispra (VA) - Italy - TP 261 Tel. +39 0332 78 3600 margherita.di-...@jrc.ec.europa.eu Disclaimer: The views expressed are purely those of the writer and may not in any circumstance be regarded as stating an official position of the European Commission. -- Best regards, Dr. Margherita DI LEO Scientific / technical project officer European Commission - DG JRC Institute for Environment and Sustainability (IES) Via Fermi, 2749 I-21027 Ispra (VA) - Italy - TP 261 Tel. +39 0332 78 3600 margherita.di-...@jrc.ec.europa.eu Disclaimer: The views expressed are purely those of the writer and may not in any circumstance be regarded as stating an official position of the European Commission. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Extract particular months from List in R
Hi Uwe, Thanks for replying. Here is a reproducible example. I would like to extract data for the Months of c(6,7,8). Output files should have the same number of columns as input files. Thanks. --- list(structure(list(Year = c(2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L, 2001L), Month = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L), Day = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L ), Site = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
[R] qqnorm with histogram?
Does a function exist that combines a normal probability plot with a histogram and maybe a density estimate on the same plot? I'm revising the Wikipedia article on Normal probability plot, and I think it would be good to provide examples of this. Thanks, Spencer p.s. Please reply also with suggestions for how to improve that Wikipedia article if you feel so inclined. __ 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] Extract particular months from List in R
On 03.08.2014 21:23, Zilefac Elvis wrote: Hi Uwe, Thanks for replying. Here is a reproducible example. I would like to extract data for the Months of c(6,7,8). Output files should have the same number of columns as input files. Thanks. [SNIP] If your data is in an object dat, then: lapply(dat, function(x) x[x[[Month]] %in% 6:8,]) or in order to combine into one data.frame: do.call(rbind, lapply(dat, function(x) x[x[[Month]] %in% 6:8,])) Best, Uwe Ligges __ 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] Extract particular months from List in R
Great! Thanks very much Uwe. AT. On Sunday, August 3, 2014 2:12 PM, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 03.08.2014 21:23, Zilefac Elvis wrote: Hi Uwe, Thanks for replying. Here is a reproducible example. I would like to extract data for the Months of c(6,7,8). Output files should have the same number of columns as input files. Thanks. [SNIP] If your data is in an object dat, then: lapply(dat, function(x) x[x[[Month]] %in% 6:8,]) or in order to combine into one data.frame: do.call(rbind, lapply(dat, function(x) x[x[[Month]] %in% 6:8,])) Best, Uwe Ligges __ 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] qqnorm with histogram?
Hi Spencer, The last example for the twoord.plot function (plotrix) does this. Jim On Sun, 3 Aug 2014 12:38:10 PM Spencer Graves wrote: Does a function exist that combines a normal probability plot with a histogram and maybe a density estimate on the same plot? I'm revising the Wikipedia article on Normal probability plot, and I think it would be good to provide examples of this. Thanks, Spencer p.s. Please reply also with suggestions for how to improve that Wikipedia article if you feel so inclined. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Convert some columns of List to dataframe R
Dear All, I have a List in R and would like to convert it to data.frame. Below is a reproducible example. I can do something like: x1-do.call(cbind.data.frame, lst3) #OR x1-as.data.frame(lst3). However, my output looks like this: Year Site x Year Site x 2001 G101 33.1 2001 G102 34 I would like to have as my output: Year G101 G102 2001 33.1 34 Thanks Atem. -- list(structure(list(Year = 2001L, Site = structure(1L, .Label = G101, class = factor), x = 33.1), .Names = c(Year, Site, x), row.names = c(NA, -1L), class = data.frame), structure(list(Year = 2001L, Site = structure(1L, .Label = G102, class = factor), x = 34), .Names = c(Year, Site, x), row.names = c(NA, -1L), class = data.frame)) __ 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] Convert some columns of List to dataframe R
On Sun, Aug 3, 2014 at 5:12 PM, Zilefac Elvis zilefacel...@yahoo.com wrote: Dear All, I have a List in R and would like to convert it to data.frame. Below is a reproducible example. I can do something like: x1-do.call(cbind.data.frame, lst3) #OR x1-as.data.frame(lst3). However, my output looks like this: Year Site x Year Site x 2001 G101 33.1 2001 G102 34 I would like to have as my output: Year G101 G102 2001 33.1 34 Thanks Atem. -- list(structure(list(Year = 2001L, Site = structure(1L, .Label = G101, class = factor), x = 33.1), .Names = c(Year, Site, x), row.names = c(NA, -1L), class = data.frame), structure(list(Year = 2001L, Site = structure(1L, .Label = G102, class = factor), x = 34), .Names = c(Year, Site, x), row.names = c(NA, -1L), class = data.frame)) Try rbind_all in the dplyr package together with the dcast() function in the reshpae2 package output1 - rbind_all(as.list(lst3)); realOutput - dcast(output1, Year ~ Site, value.var=x); Example transcript: lst3 - list(structure(list(Year = 2001L, Site = structure(1L, .Label = G101, class = factor), + x = 33.1), .Names = c(Year, Site, x), row.names = c(NA, + -1L), class = data.frame), structure(list(Year = 2001L, Site = structure(1L, .Label = G102, class = factor), + x = 34), .Names = c(Year, Site, x), row.names = c(NA, + -1L), class = data.frame)) library(dplyr); rbind_all(lst3); Year Sitex 1 2001 G101 33.1 2 2001 G102 34.0 Warning message: In rbind_all(lst3) : Unequal factor levels: coercing to character dcast(output1,Year ~ Site,value.var=x) Year G101 G102 1 2001 33.1 34 Sorry for the extra reply. 60 hour work weeks and 61 years of age don't mix well. Back to watching Beakman on Netflix. -- There is nothing more pleasant than traveling and meeting new people! Genghis Khan Maranatha! John McKown __ 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] Convert some columns of List to dataframe R
Hi John, Thanks. As you said, I want the Site values to become individual variable names whose value is in the x column: Output should look exactly like: Year G101 G102 2001 33.1 34 Thanks, Atem. On Sunday, August 3, 2014 4:48 PM, John McKown john.archie.mck...@gmail.com wrote: On Sun, Aug 3, 2014 at 5:43 PM, John McKown john.archie.mck...@gmail.com wrote: On Sun, Aug 3, 2014 at 5:12 PM, Zilefac Elvis zilefacel...@yahoo.com wrote: Dear All, I have a List in R and would like to convert it to data.frame. Below is a reproducible example. I can do something like: x1-do.call(cbind.data.frame, lst3) #OR x1-as.data.frame(lst3). However, my output looks like this: Year Site x Year Site x 2001 G101 33.1 2001 G102 34 I would like to have as my output: Year G101 G102 2001 33.1 34 Thanks Atem. snip Try rbind_all in the dplyr package. output - rbind_all(as.list(lst3)); Example transcript: lst3 - list(structure(list(Year = 2001L, Site = structure(1L, .Label = G101, class = factor), + x = 33.1), .Names = c(Year, Site, x), row.names = c(NA, + -1L), class = data.frame), structure(list(Year = 2001L, Site = structure(1L, .Label = G102, class = factor), + x = 34), .Names = c(Year, Site, x), row.names = c(NA, + -1L), class = data.frame)) library(dplyr); rbind_all(lst3); Year Site x 1 2001 G101 33.1 2 2001 G102 34.0 Warning message: In rbind_all(lst3) : Unequal factor levels: coercing to character OOPS. Didn't got far enough. You want the Site values to become individual variable names whose value is in the x column. Some days I need more naps. But I think that this is the starting point. More later. Sorry. -- There is nothing more pleasant than traveling and meeting new people! Genghis Khan Maranatha! John McKown -- There is nothing more pleasant than traveling and meeting new people! Genghis Khan Maranatha! John McKown __ 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] About a R learning course
Hadley wickham is goting to teach a two day course on advanced R and package development in NYC, Sep 8-9. You can learn more in https://www.eventbrite.com/e/master-r-developer-workshop-tickets-11846598495 Could students from NYC make a trial to recording the course if permitted? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to overlay contourplot of a dataset A and a levelplot of a dataset B?
Hi Charles, You don't need as.layer. levelplot(z ~ x*y,grid2) + contourplot(z ~ x*y,grid1) is enough. Regards, Pascal On Sun, Aug 3, 2014 at 5:59 PM, Charles Novaes de Santana charles.sant...@gmail.com wrote: Dear all, Just to inform that I have solved my problem in a very elegant way, thanks to the layer approach given by package latticeExtra. After loading my grids like before: x-1:10 y-1:10 grid1-expand.grid(x=x,y=y) grid2-expand.grid(x=x,y=y) z1-grid1$x^2 + grid1$y^2 z2-2*grid2$x^2 - grid2$y^2 grid1$z-z1 grid2$z-z2 I just need to do: levelplot(z ~ x*y,grid2) + as.layer(contourplot(z ~ x*y,grid1)); The result is a beautiful plot with a contourplot over a levelplot. There are some examples of overlay of trellis plots in the manual of latticeExtra: http://latticeextra.r-forge.r-project.org/ Thank you for your attention, Best, Charles On Sat, Aug 2, 2014 at 4:01 PM, Charles Novaes de Santana charles.sant...@gmail.com wrote: Dear all, Does anyone know a way to overlay a contourplot and a levelplot of different datasets, both datasets with the same dimension? Let's say I have 2 10x10 grids, like those below: library(lattice) x-1:10 y-1:10 grid1-expand.grid(x=x,y=y) grid2-expand.grid(x=x,y=y) z1-grid1$x^2 + grid1$y^2 z2-2*grid2$x^2 - grid2$y^2 grid1$z-z1 grid2$z-z2 I would like to plot z1 and z2 in the same plot: z1 as a contourline and z2 as a levelplot. I tried to do this in two ways, without success: plot.new(); contourplot(z ~ x*y,grid1) par(new=T) levelplot(z ~ x*y,grid2) and levelplot(z ~ x*y,grid1,region=FALSE,contour=TRUE) par(new=T) levelplot(z ~ x*y,grid2,region=TRUE,contour=FALSE) Any clue? Thank you very much for your time and any help! Charles -- Um axé! :) -- Charles Novaes de Santana, PhD http://www.imedea.uib-csic.es/~charles -- Um axé! :) -- Charles Novaes de Santana, PhD http://www.imedea.uib-csic.es/~charles [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Pascal Oettli Project Scientist JAMSTEC Yokohama, Japan __ 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.