Re: [R] Fortune candidate

2018-01-27 Thread Rich Shepard
On Sat, 27 Jan 2018, David Winsemius wrote: John (to a serial querulant): ...but with such a sweeping lack of information from you, don't congratulate yourself if you get a helpful answer. It wasn't your fault. Looks like what H.L. Menken or P.G. Wodehouse would have written. Rich ___

Re: [R] Learning advanced R

2018-03-13 Thread Rich Shepard
On Tue, 13 Mar 2018, Mark Leeds wrote: See Hadley's advanced R +1 A very well writte, highly useful book. Recommended. Rich __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE d

Re: [R] Learning advanced R

2018-03-14 Thread Rich Shepard
On Wed, 14 Mar 2018, Barry Rowlingson wrote: Depending on your application, I'm not sure there's much point in being an "advanced R programmer" these days. Become an adequate R programmer, and learn C++ and Rcpp. Do basic data mashing in R, then do all your intensive stuff in C++ with Rcpp. Even

Re: [R] Learning advanced R

2018-03-14 Thread Rich Shepard
On Wed, 14 Mar 2018, Duncan Murdoch wrote: I'm all for learning more languages and using the one that's best for each job, but for people who don't know Python, it would be helpful to list the aspects in which it excels. When should an R user choose to write something in Python instead? Duncan

Re: [R] Fwd: Learning advanced R

2018-03-14 Thread Rich Shepard
On Wed, 14 Mar 2018, Jeff Newmiller wrote: Nothing you have said tells me you have LaTeX working (a binary install of R does not depend on it), but if you actually know it is installed and available to R then that isn't the problem. Since you have not said what you actually did or what errors yo

Re: [R] R 3.4.4 is released

2018-03-15 Thread Rich Shepard
On Thu, 15 Mar 2018, Peter Dalgaard via R-help wrote: The build system rolled up R-3.4.4.tar.gz (codename "Someone to Lean On") this morning. Peter, My thanks to all developers for the work you do. Best regards, Rich __ R-help@r-project.org mai

[R] update.packages() after updating R version

2018-05-26 Thread Rich Shepard
R-3.5.0 is installed here. When I tried to update installed packages errors were reported when their dependencies were built under a prior version of R. Reading ?update.packages() I did not see an option that would automatically update dependences built under an earlier version of R. Is there

Re: [R] update.packages() after updating R version

2018-05-26 Thread Rich Shepard
On Sat, 26 May 2018, Bert Gunter wrote: Is this warning in ?update.packages relevant? Bert, Short answer: no. I have only a single R library here: /usr/lib/R/library. I've tried 'install.packages("", dependencies = TRUE) and still need to follow the dependencies chain down, re-install

Re: [R] update.packages() after updating R version [RESOLVED]

2018-05-27 Thread Rich Shepard
On Sat, 26 May 2018, Duncan Murdoch wrote: I think you want update.packages(ask = FALSE, checkBuilt = TRUE) to automatically update all packages and their dependencies. With the default checkBuilt=FALSE, R just sees whether a dependency is a high enough version number. But packages installed und

[R] Suggestions for scatter plot of many data

2018-07-18 Thread Rich Shepard
I have daily precipitation data for 58 locations from 2005-01-01 through 2018-06-18. Among other plots and analyses I want to apply lattice's xyplot() to illustrate the abundance and patterns of the data. I've used a vector of colors (and a key) when there were only eight weather stations and

[R] Read in data table, change columns from factors

2018-07-18 Thread Rich Shepard
A set of data files have this format: date,time,elev 1988-10-01,00:30,87.6849 1988-10-01,01:00,87.6849 1988-10-01,01:30,87.6849 1988-10-01,02:00,87.6879 1988-10-01,02:30,87.6879 1988-10-01,03:00,87.691 1988-10-01,03:30,87.694 Importing it with this command: allyears <- read.table('allyears.da

Re: [R] Read in data table, change columns from factors

2018-07-18 Thread Rich Shepard
On Wed, 18 Jul 2018, David Winsemius wrote: I would not destroy the possibility of using the original values: David, What are the benefits of keeping date and time as factors? allyears$myDate <- as.Date(as.character(allyears$date)) allyears$myTime <- as.POSIXct(paste(allyears$date, allyea

Re: [R] Read in data table, change columns from factors

2018-07-18 Thread Rich Shepard
On Wed, 18 Jul 2018, David Winsemius wrote: It's not so much as factors but rather in a form that paste() will coerce to character so you cna get the automatic format David, Now I understand. Maybe you need to add a format string. It might force some of your pasted date+time values to NA

Re: [R] Read in data table, change columns from factors

2018-07-19 Thread Rich Shepard
On Wed, 18 Jul 2018, Rich Shepard wrote: If you would suggest how many would be an acceptably large number I'll be happy to put that on a 'cloud' sharing site and provide the URL to it. I put a zipped data file at this URL: <http://www.filecon

Re: [R] Suggestions for scatter plot of many data

2018-07-19 Thread Rich Shepard
On Thu, 19 Jul 2018, Duncan Mackay wrote: Try something like this ... Duncan, That's impressive and well beyond anything I've done in the past. I'll study it to fully understand it and make it work for me. I have put over 60 panels on an A4 page. Space is a premium - you can reduce the

Re: [R] Read in data table, change columns from factors

2018-07-19 Thread Rich Shepard
On Thu, 19 Jul 2018, Rich Shepard wrote: I put a zipped data file at this URL: <http://www.fileconvoy.com/dfl.php?id=g61a366bb8947de4319863935141c96f82092d4> Since then I reformatted the file to two fields: date-time and elevation. If anyone wants a copy send me a message off th

Re: [R] Read in data table, change columns from factors

2018-07-19 Thread Rich Shepard
On Thu, 19 Jul 2018, Rich Shepard wrote: Since then I reformatted the file to two fields: date-time and elevation. If anyone wants a copy send me a message off the list and I'll respond with the modified file attached. This is a mistake. The file needs commas separating each field.

Re: [R] Suggestions for scatter plot of many data

2018-07-19 Thread Rich Shepard
On Thu, 19 Jul 2018, Berry, Charles wrote: So roughly 5000 observations of latitiude, longitude, elevation(?), and amount. Maybe something dynamic like Hans Rosling does: https://towardsdatascience.com/how-to-build-animated-charts-like-hans-rosling-doing-it-all-in-r-570efc6ba382 possibly smoo

Re: [R] Read in data table, change columns from factors

2018-07-19 Thread Rich Shepard
On Thu, 19 Jul 2018, Rich Shepard wrote: I have the date and elev columns converted from factors to date and numeric, respectively, but still have not learned how to convert the time. With this dataframe structure, str(wy2018) 'data.frame': 12592 obs. of 3 variables: $

Re: [R] Read in data table, change columns from factors [RESOLVED]

2018-07-19 Thread Rich Shepard
On Thu, 19 Jul 2018, David Winsemius wrote: I took the code that I offered earlier and replaced allyears with wy2018: date timeelev myDate myTime 1 2017-10-01 00:00 290.298 2017-10-01 2017-10-01 00:00:00 2 2017-10-01 00:30 290.301 2017-10-01 2017-10-01 00:30:00 3

Re: [R] Read in data table, change columns from factors [RESOLVED]

2018-07-19 Thread Rich Shepard
On Thu, 19 Jul 2018, David Winsemius wrote: You can use format to only display the time portion of a datetime object. format( Sys.time(), "%H:%M") [1] "13:57" You can append the current date to a "time-only" character value and as.POSIXct will do that for you: as.POSIXct("00:00", format="%H:%M"

[R] Scripting a repeating work flow

2018-07-19 Thread Rich Shepard
I have 30 data files that all need to be read into R, formatted, and have scatter plots prepared. This process can be done in a short script. I would like to generalize the script so that variables (such as data file names) can be read from another file and all files processed sequentially, simi

Re: [R] Scripting a repeating work flow

2018-07-19 Thread Rich Shepard
On Thu, 19 Jul 2018, David Winsemius wrote: https://markmail.org/search/?q=list%3Aorg.r-project.r-help+script+process+multiple+csv+files https://stackoverflow.com/questions/11433432/importing-multiple-csv-files-into-r https://www.google.com/search?q=use+r+to+process+multiple+csv+files&oq=use+r+t

Re: [R] Suggestions for scatter plot of many data

2018-07-19 Thread Rich Shepard
On Thu, 19 Jul 2018, William Michels wrote: Hello, In addition to Duncan Mackay's excellent suggestion, I would recommend Bert Gunter's "stripless" package, for high-density Trellis-type conditioning plots. See the vignette for examples, and try out the code for "earthquake" and "barley" plots f

Re: [R] Suggestions for scatter plot of many data

2018-07-20 Thread Rich Shepard
On Fri, 20 Jul 2018, Duncan Mackay wrote: If you have to make several plots you can subset your data Duncan, That's what I thought I should do. xyplot(... data = subset(x, condition), ...) or XYn <- xyplot(... data = x[row1:row2, ], ...) in a loop have a look a ? print.trellis if you wa

[R] Locating data source error in large file

2018-07-20 Thread Rich Shepard
The structure of the dataframe is str(wy2016) 'data.frame': 8784 obs. of 4 variables: $ date : chr "2015-10-01" "2015-10-01" "2015-10-01" "2015-10-01" ... $ time : chr "00:00" "01:00" "02:00" "03:00" ... $ elev : num 90.7 90.7 90.7 90.7 90.7 ... $ myDate: Date, format: "2015-10-01"

Re: [R] Locating data source error in large file

2018-07-20 Thread Rich Shepard
On Fri, 20 Jul 2018, William Dunlap wrote: The problem occurs because no commonly used format works on all your date strings. If you give as.POSIXlt the format you want to use then items that don't match the format will be treated as NA's. Use is.na() to find them. Bill, No NAs found using

Re: [R] Locating data source error in large file

2018-07-20 Thread Rich Shepard
On Fri, 20 Jul 2018, William Dunlap wrote: Which format did you use when you used is.na on the output of as.POSIXlt(strings, format=someFormat) and found none? Did the resulting dates look OK? Perhaps all is well. Bill, All dates here are kept as -mm-dd. And each dataframe row ha

Re: [R] Locating data source error in large file

2018-07-20 Thread Rich Shepard
On Fri, 20 Jul 2018, David Winsemius wrote: I don't think you read Bill's message properly. David, Obviously not. He was not saying that there were NA's; he was telling you to use a format specification in your as.POSIXct call and the the result of that call would have NA's. wy2016$dt_ti

Re: [R] Locating data source error in large file

2018-07-20 Thread Rich Shepard
On Fri, 20 Jul 2018, Eric Berger wrote: This may not be the most efficient but it will identify the offenders. foo <- paste(wy2016$date, wy2016$time)) uu <- sapply(1:length(foo), function(i) { a <- try(as.POSIXct(foo[i]),silent=TRUE) "POSIXct" %in% class(a) }) which

Re: [R] Locating data source error in large file

2018-07-20 Thread Rich Shepard
On Fri, 20 Jul 2018, David Winsemius wrote: wy2016$dt_time <- with( wy2016, as.POSIXct( paste( date, time ) , format= "%Y-%m-%d %H:%M") ) David/Bill/Eric: Thank you all. I found the typos which covered a single day toward the end of the dataframe. Carpe weekend, Rich

Re: [R] Locating data source error in large file

2018-07-20 Thread Rich Shepard
On Fri, 20 Jul 2018, William Dunlap wrote: You mean each line in the file, not row in data.frame, has the form "year-month-day,hour:min,numericValue". Try the following, where tfile names your file: Bill, Yes, I was looking at the data file in one emacs buffer and my R session in another on

Re: [R] Locating data source error in large file

2018-07-20 Thread Rich Shepard
On Fri, 20 Jul 2018, Rich Shepard wrote: Thank you all. I found the typos which covered a single day toward the end of the dataframe. FWIW, all these data came from PDF reports and had to be manually highlighted and pasted into a text file. Given 29 years of hourly (and sometimes half

Re: [R] Locating data source error in large file

2018-07-20 Thread Rich Shepard
On Fri, 20 Jul 2018, William Dunlap wrote: To find the lines in the file, tfile, with bogus dates, try readLines(tfile)[ is.na(dataFrame$DateTime) ] Bill, Thanks for another lesson. Regards, Rich __ R-help@r-project.org mailing list -- To UN

Re: [R] Automate running files in R

2018-07-22 Thread Rich Shepard
On Sun, 22 Jul 2018, Serena De Stefani wrote: I need to automate a process in R. Basically I have a an R script (I will call it R1) that needs three separate files to run. These three files are the results output of one trial in my study. The trials are specified by the labels: AA AB AM BA BB

[R] A couple of batch mode questions

2018-07-25 Thread Rich Shepard
Within R one can use source() to run a batch file of R commands, while R CMD BATCH and Rscript are run from the command line. Is this correct? Given these choices, when would I want to run a script within R using source(), and when would it be better for me to run it from the command line?

Re: [R] A couple of batch mode questions

2018-07-25 Thread Rich Shepard
On Wed, 25 Jul 2018, Bert Gunter wrote: "Within R one can use source() to run a batch file of R commands, while R CMD BATCH and Rscript are run from the command line. Is this correct?" Yes. Bert, Thanks for confirming. I think your query answers your query: You use Rscript when you want

Re: [R] A couple of batch mode questions [ANSWERED]

2018-07-25 Thread Rich Shepard
On Wed, 25 Jul 2018, Rich Shepard wrote: That's a given. Why would I prefer Rscript over R CMD BATCH, or vice-versa? I did not see much difference between the two in their help files. Digging deeper into the Web I read that R CMD BATCH is an older approach to automating R processing

Re: [R] A couple of batch mode questions

2018-07-25 Thread Rich Shepard
On Wed, 25 Jul 2018, MacQueen, Don wrote: From my perspective, which is a unix-alike perspective, Rscript makes R useable in exactly the same way as other unix style scripting languages such as perl, tcsh, bash, etc. This is useful, and a good thing. If I remember (and understood) correctly, it

Re: [R] A couple of batch mode questions

2018-07-25 Thread Rich Shepard
On Wed, 25 Jul 2018, Eric Berger wrote: 1. For R scripts you should also consider the package littler developed by Dirk Eddelbuettel, Highly recommended. For info http://dirk.eddelbuettel.com/code/littler.html or the github repository. Eric, I'll definintely look at that package. 2. Scrip

Re: [R] A couple of batch mode questions

2018-07-25 Thread Rich Shepard
On Wed, 25 Jul 2018, Eric Berger wrote: You should be able to do all this within R. From what you have written I don't see a compelling reason to use scripts at the shell level. Eric, The source() help page's last example calls a set of scripts to run sequentially. I assume this is used to

Re: [R] A couple of batch mode questions

2018-07-25 Thread Rich Shepard
On Wed, 25 Jul 2018, Bert Gunter wrote: Eric may have more to say, but the straightforward answer is: use functions to do what you want and pass any file specific info to them as parameters of function calls. Bert, I was considering that functions would be the way to go. The functions can c

Re: [R] Batch mode questions.

2018-07-25 Thread Rich Shepard
On Wed, 25 Jul 2018, Shawn Way wrote: To get you start, here's a script I used to combine any number of files into one data.frame. library(knitr) library(tidyverse) library(xlsx) library(xtable) library(lubridate) # create a list from these files list.filenames<-list.files(pattern=".CSV$") #

Re: [R] Batch mode questions.

2018-07-25 Thread Rich Shepard
On Wed, 25 Jul 2018, David Winsemius wrote: # create a list from these files list.filenames<-list.files(pattern=".CSV$") # This gets a list of all CSV files It would get all the files with all caps "CSV" anywhere within the file name, but it would not get any files with an extension ".csv", n

[R] ESS issue: lines moved right 40 spaces

2018-07-26 Thread Rich Shepard
I used to be subscribed to the ess SIG, but cannot find any saved messages from that list and I cannot find it in the list of mail lists on the r-project web site. So I'll ask here. Running ess-5.14 on emacs-25.3 I'm seeing a different behavior when I write scripts than I had seen in the past

Re: [R] ESS issue: lines moved right 40 spaces

2018-07-26 Thread Rich Shepard
On Thu, 26 Jul 2018, Anthony Hirst wrote: I don't know the answer but here is the info for the ess list. ess-h...@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help Anthony, Thanks! I thought that was the name but did not see it on the help page and didn't think of lo

Re: [R] ESS issue: lines moved right 40 spaces

2018-07-26 Thread Rich Shepard
On Thu, 26 Jul 2018, Marc Schwartz wrote: The full list of e-mail lists is here: https://stat.ethz.ch/mailman/listinfo/ and the ESS-Help list is here: https://stat.ethz.ch/mailman/listinfo/ess-help which is also referenced on the ESS web site: http://ess.r-project.org/index.php?Section=gettin

Re: [R] ESS issue: lines moved right 40 spaces

2018-07-26 Thread Rich Shepard
On Thu, 26 Jul 2018, jeremieju...@gmail.com wrote: Do you use single # or double hash ## when you comment? as far as i know there are 3 types of comment indentation on ESS. # ## ### In principle comment with # get centered. Jeremie, I was not aware of this I've always used a single # for c

Re: [R] ESS issue: lines moved right 40 spaces

2018-07-26 Thread Rich Shepard
On Thu, 26 Jul 2018, Marc Schwartz wrote: There is a reasonable chance that your ESS version, given its age, may be incompatible with some of the under the hood changes in Emacs since then, including changes to variable names, etc. Marc, The build script fails because it cannot find an info

Re: [R] ESS issue: lines moved right 40 spaces

2018-07-26 Thread Rich Shepard
On Thu, 26 Jul 2018, Rich Shepard wrote: I was not aware of this I've always used a single # for comment everywhere that's the correct symbol. I'll try two of 'em. Reading the 17.11 user guide I see what #, ##, and ### do. I also put the suggested line to remove t

Re: [R] ESS issue: lines moved right 40 spaces

2018-07-27 Thread Rich Shepard
On Fri, 27 Jul 2018, Eric Berger wrote: I also use emacs with ESS for editing R files and I have been living with the comment indentation problem you described. Based on the comments in this thread I did a search and found a posted solution that works for me. See https://stat.ethz.ch/pipermail/e

[R] Formatting summary() output to a file

2018-07-27 Thread Rich Shepard
I want to save the output of summary(df_name) to a disk file and my research found that the sink() function is what I want to use. The 'R Cookbook' provides a an alternative example using cat() to a connection. Here, con <- file("wysumallyrs.txt", "w") cat(summary(wyallyrs), file=con) close(con

Re: [R] Somewhat obscure bug in R 3.4.0 building from source

2017-05-21 Thread Rich Shepard
On Sun, 21 May 2017, Peter Carbonetto wrote: The error occurs only when I do "make clean" followed by "make" again; make works the first time. Peter, I suggest you use 'make distclean' rather than 'make clean.' There are subtle differences between the two, yet the former is more complete. T

Re: [R] R-specific Software Requirement Specification

2016-09-07 Thread Rich Shepard
On Wed, 7 Sep 2016, Doran, Harold wrote: I'm building a large program with many different people contributing to the coding in R and so it needs a well-articulated design spec. The program will have many different functions that must interact with each other, but the individual functions will be

[R] Results Differ in Ternary Plot Matrix of Compositional Response Variables

2015-04-30 Thread Rich Shepard
After hours of looking for the reason why one data set plots correctly and another one does not I am still not seeing the reason. The only differences I see between the two data sets is the number of discrete variables (one has 6 years, the other 7 years) and one contains zeros. I wonder if the

[R] Plot Title: Adjusting Position

2015-05-01 Thread Rich Shepard
Plots of compositional data ternary diagrams do not accept the main label within the plot() function, but do print the label when it is specified within the title() function. On some of these plots I need to raise the position of the title just enough to move the text above the top row of diagra

Re: [R] Plot Title: Adjusting Position

2015-05-01 Thread Rich Shepard
On Fri, 1 May 2015, David L Carlson wrote: There are half a dozen implementations of ternary plots in as many R packages so it is hard to be specific. David, I'm using the compositions() package. Since you are using title(), try the "further graphical parameters from par" mentioned in the

Re: [R] Results Differ in Ternary Plot Matrix of Compositional Response Variables

2015-05-01 Thread Rich Shepard
On Fri, 1 May 2015, David L Carlson wrote: Add plotMissings=FALSE to the second plot and see the plot.acomp manual page description of this argument: plot(JerrittY, pch=as.numeric(JerrittX4), col=c("black","red", "dark green", "dark blue","dark goldenrod","dark orange","dark grey")[JerrittX

Re: [R] Plot Title: Adjusting Position [RESOLVED]

2015-05-01 Thread Rich Shepard
On Fri, 1 May 2015, David L Carlson wrote: There are half a dozen implementations of ternary plots in as many R packages so it is hard to be specific. Since you are using title(), try the "further graphical parameters from par" mentioned in the manual page such as adj=c(x, y) for position (or ma

[R] Calling Function With Arguments In a Script

2015-05-07 Thread Rich Shepard
I'm starting to put code in multi-use functions rather than in individual scripts and have not learned how to invoke the function from the command line. If this information is in Norman Matloff's 'The Art of R Programming' or Hadley Wickham's 'Advanced R' please point me to the proper place.

Re: [R] Calling Function With Arguments In a Script

2015-05-07 Thread Rich Shepard
On Thu, 7 May 2015, Bert Gunter wrote: See e.g. Chapter 10.4 in the "Intro to R Tutorial" on the "..." argument. Bert, Thanks. That was going to be my next step. Much appreciated, Rich __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and

Re: [R] Calling Function With Arguments In a Script

2015-05-07 Thread Rich Shepard
On Thu, 7 May 2015, Clint Bowman wrote: as in source("pairwise-plots-continuous-vars.R") Clint, I did this before converting it to a function, when I modified the variables in the script. Did not try it as a function, should have. Thanks, Rich

[R] CoDA ANOVA Error

2015-05-08 Thread Rich Shepard
I'm running linear regressions and ANOVAs on 5 sets of compositional data following van den Boogaart and Tolosana-Delgado's book, pp. 129 ff. Four of the five data sets compute without error; one does not. To test results, load package 'compositions'. The input data: structure(c(0.1896810318

[R] Specifying Directory to Search When Updating a Package

2015-05-08 Thread Rich Shepard
R packages here are installed in /usr, not /usr/local/. Most of the time when I run 'update.packages()' each finds headers in /usr/include. Today, the package 'rgl' failed to build because it was looking for freetype.h in /usr/local/include/freetype2/. By making a softlink from /usr/include/f

[R] Compositional ANOVA With Several Main Effects: Explanation of Results

2015-05-11 Thread Rich Shepard
The results of compositional ANOVA models with several main effects with conditional data as the response variable produce 'missing not at random' (MNAR) results for the same rows in the matrix of output coefficients: the last, third from last, and fourth from last regardless of the number of ye

Re: [R] R programming

2015-05-23 Thread Rich Shepard
On Fri, 22 May 2015, varun joshi wrote: What should I do to learn gradually? Not sure how one gradually learns; I suppose it depends on what sort of applications one wants to develop and the most effective means by which one learns. Regardless, a good place to start is by buying and reading

Re: [R] cannot run package anymore

2015-06-04 Thread Rich Shepard
On Thu, 4 Jun 2015, T.Riedle wrote: Error: package 'sandwich' could not be loaded I have no idea why this happens. I have not done anything before. Er, the answer is shown. What can I do to solve this problem? Install the latest sandwich (hold the mayo), then re-install the package req

[R] Formatting YYYY-MM after reading text file

2015-06-26 Thread Rich Shepard
Data file 'example.dat' has this format: stream,sampdate,param,quant B,1992-03,Cl,4 B,1992-03,SO4,33 B,1992-03,pH,8.43 B,1992-04,Cl,4 B,1992-04,SO4,32 B,1992-04,pH,8.46 B,1992-05,Cl,4 B,1992-05,SO4,31 B,1992-05,pH,8.43 It's read into R with allchem <- read.table('example.dat', stringsAsFacto

Re: [R] Formatting YYYY-MM after reading text file [RESOLVED]

2015-06-26 Thread Rich Shepard
On Fri, 26 Jun 2015, Rich Shepard wrote: allchem$sampdate <- as.yearmon(format(%Y-%m))allchem$sampdate Reading the yearmon help page again led me to try allchem$sampdate <- as.yearmon(allchem$sampdate) which produces the following structure: 'data.frame':

Re: [R] Formatting YYYY-MM after reading text file [RESOLVED]

2015-06-26 Thread Rich Shepard
On Fri, 26 Jun 2015, MacQueen, Don wrote: I would have just assigned them all to the first day of the month, using as.Date( paste0(allchem$sampdate,'-01') ) (or maybe the middle of the month represented by the 15th) and then had a variable that was of the Date class in the base R (with which I

[R] Subset() within function: logical error

2015-06-29 Thread Rich Shepard
Moving from interactive use of R to scripts and functions and have bumped into what I believe is a problem with variable names. Did not see a solution in the two R programming books I have or from my Web searches. Inexperience with ess-tracebug keeps me from refining my bug tracking. Here's a

Re: [R] Subset() within function: logical error

2015-06-29 Thread Rich Shepard
On Tue, 30 Jun 2015, Steve Taylor wrote: Using return() within a for loop makes no sense: only the first one will be returned. Steve, Mea culpa. Didn't catch that. How about: alldf.B = subset(alldf, stream=='B') # etc... I used to do each stream manually, like the above, and want to

Re: [R] Subset() within function: logical error

2015-06-29 Thread Rich Shepard
On Mon, 29 Jun 2015, David Winsemius wrote: No. A pointer to the correct use of "[" is needed. Thanks, David. This puts me on the the right path. Much appreciated, Rich __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https:/

Re: [R] Subset() within function: logical error

2015-06-29 Thread Rich Shepard
On Tue, 30 Jun 2015, Rolf Turner wrote: If you want a pointer to the correct syntax for subset(), try help("subset")!!! The syntax of your "extstream" function is totally screwed up, convoluted and over-complicated. Note that even if you had your "subset" argument specified correctly, the re

[R] Lattice: set col = "black" for box.rectangle and box.umbrella

2015-07-02 Thread Rich Shepard
Lattice's bwplot() displays and prints (using pdf()) the box.rectangle and box.umbrella in a pale blue that is a pale gray on b&w laser printer output. I would like to set default options so the box and whiskers are displayed and printed in black by modifying ~/.Rprofile by adding a .First() fun

Re: [R] Lattice: set col = "black" for box.rectangle and box.umbrella

2015-07-02 Thread Rich Shepard
On Thu, 2 Jul 2015, David Winsemius wrote: The lead-in to section 7.2 mentions `trellis.par.get`, but in order to change anything you need to use `trellis.par.set` as was illustrated in the pages leading up to that section: David, I saw `trellis.par.set` but did not know how to use that in

Re: [R] Lattice: set col = "black" for box.rectangle and box.umbrella

2015-07-02 Thread Rich Shepard
On Thu, 2 Jul 2015, David Winsemius wrote: My .Rprofile has this (among other items): ... David, My attempts at adding lattice.options to .Rprofile fail. In that file is lattice.options(trellis.par.set(list( box.umbrella=list(col="black"), box.rectangle=l

Re: [R] Lattice: set col = "black" for box.rectangle and box.umbrella

2015-07-02 Thread Rich Shepard
On Thu, 2 Jul 2015, Rich Shepard wrote: ... and invoking R within emacs ... Trying a different approach: bwplot(quant ~ param, data = b, main = 'Stream B Constituents', ylab = 'Concentration (mg/L)', xlab = 'Constituent', par.settings = simpleTh

Re: [R] Lattice: set col = "black" for box.rectangle and box.umbrella

2015-07-02 Thread Rich Shepard
On Thu, 2 Jul 2015, Bert Gunter wrote: 1. box.rectangle, etc. are not functions; they are (lists of) parameters that are sublists of the par.settings list. Bert, Thought so ... 2. Read the Help for simpleTheme() -- it has a specific list of parameters which is nothing like what you show.

Re: [R] Lattice: set col = "black" for box.rectangle and box.umbrella

2015-07-03 Thread Rich Shepard
On Fri, 3 Jul 2015, Duncan Mackay wrote: I usually avoid global settings as they may change between graphs therefore I use the par.settings in each plot My settings are ... Duncan, Thank you very much. Sound advice and excellent example. I suspect that part of my issues with tryin

Re: [R] Lattice: set col = "black" for box.rectangle and box.umbrella

2015-07-04 Thread Rich Shepard
On Sat, 4 Jul 2015, Duncan Mackay wrote: Just a thought Have you set pch colour values somewhere else? Duncan, Not on purpose. see also https://stat.ethz.ch/pipermail/r-help/2010-March/230329.html Will do. Thanks, Rich __ R-help@r-project

[R] Trellis Plots: translating lattice xyplot() to ggplot()

2015-07-10 Thread Rich Shepard
Hadley's ggplot2 book is quite old and a new version is in the works, but not yet out. I've been using lattice graphics but the knitr package doesn't support lattice, only basic plots and ggplot2. My Web searches for Trellis plots in ggplot2 equivalent to those in lattice have not been productiv

Re: [R] Trellis Plots: translating lattice xyplot() to ggplot()

2015-07-10 Thread Rich Shepard
On Fri, 10 Jul 2015, Roy Mendelssohn - NOAA Federal wrote: Don’t know for certain but might this help: http://journal.r-project.org/archive/2015-1/murrell.pdf From the latest issue of R Journal. Roy, Thanks. I'll certainly read that article. Carpe weekend, Rich __

Re: [R] Trellis Plots: translating lattice xyplot() to ggplot()

2015-07-10 Thread Rich Shepard
On Fri, 10 Jul 2015, Roy Mendelssohn - NOAA Federal wrote: Don’t know for certain but might this help: It's very interesting, but does not appear to resolve the immediate need to write the R code in a knitr chunk for incorporation into the compiled LyX document. The gridGraphics package d

Re: [R] Trellis Plots: translating lattice xyplot() to ggplot()

2015-07-10 Thread Rich Shepard
On Fri, 10 Jul 2015, Hadley Wickham wrote: Have you tried explicitly print()ing the lattice graphics in your knitr doc? Hadley, Only now. Had not thought of trying this before. pdf('carlin-1-descriptive.pdf') print(xyplot(value ~ sampdate | variable, data=carlin.1.melt, rm.na = T)) No err

Re: [R] Trellis Plots: translating lattice xyplot() to ggplot()

2015-07-10 Thread Rich Shepard
On Fri, 10 Jul 2015, Hadley Wickham wrote: You shouldn't be explicitly opening a device in a knitr document. Hadley, Didn't think so. I think maybe you should post a minimal document so we can figure out what's going wrong. Agreed. Attached are the raw data (carlin.csv) and a stripped

Re: [R] Trellis Plots: translating lattice xyplot() to ggplot()

2015-07-10 Thread Rich Shepard
On Fri, 10 Jul 2015, David Winsemius wrote: #Generally one needs to complete a pdf() call with: dev.off() # And an empty file is the symptom os such a failure. David, I did leave that off the example file, but it make no difference. The attached is the compiled example.pdf Rich example

Re: [R] Trellis Plots: translating lattice xyplot() to ggplot()

2015-07-11 Thread Rich Shepard
On Fri, 10 Jul 2015, Yihui Xie wrote: Your LyX example has two problems: 1) We don't have your .RData; 2) You didn't library(reshape) and library(lattice). Hence it is not a self-contained reproducible example. Yihui, I assumed that reading in the *.csv file would create a local .RData file

Re: [R] Trellis Plots: translating lattice xyplot() to ggplot() [RESOLVED]

2015-07-11 Thread Rich Shepard
On Fri, 10 Jul 2015, Yihui Xie wrote: Your LyX example has two problems: Yihui, et al.: All fixed now. After adding the specific libraries the chuck calling xyplot() to produce the graphic caused an error when I tried to generate a dvips preview: LaTeX Error: File 'figure/unnamed-chunk-7-1

Re: [R] Knitr/Lattice/Lyx [was: Trellis Plots: translating lattice xyplot() to ggplot()]

2015-07-11 Thread Rich Shepard
On Sat, 11 Jul 2015, Yihui Xie wrote: I guess you didn't tell us you were compiling the document with dvips That's how I preview lyx docs for the past decade-and-a-half or so. The final .pdf is generated with pdflatex. There is now an issue when a second figure is added to the document: i

Re: [R] Knitr/Lattice/Lyx [was: Trellis Plots: translating lattice xyplot() to ggplot()]

2015-07-11 Thread Rich Shepard
On Sat, 11 Jul 2015, Rich Shepard wrote: Attached are the .RData file from the cwd, the test.lyx file (lyx-2.1.3), and the two test files from /tmp/.../lyx_tmpbuf3/. The .RData and .lyx files were stripped off. I'll try sending them again. Rich#LyX 2.1 created this file. For more inf

Re: [R] Knitr/Lattice/Lyx [was: Trellis Plots: translating lattice xyplot() to ggplot()]

2015-07-11 Thread Rich Shepard
On Sat, 11 Jul 2015, Rich Shepard wrote: The .RData and .lyx files were stripped off. I'll try sending them again. .RData didn't make it. Perhaps now. Rich __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://st

Re: [R] Knitr/Lattice/Lyx [was: Trellis Plots: translating lattice xyplot() to ggplot()]

2015-07-12 Thread Rich Shepard
On Sat, 11 Jul 2015, Yihui Xie wrote: There is a ')' missing in the end. When you see errors from parse(), that often means the code is not syntactically correct. Most sincere appologies for my not catching that each time I looked at the code. Will be more thorough and put the problem aside

[R] Displaying Compositional Data With 46 Parts

2015-07-17 Thread Rich Shepard
The compositional data have been divided into two data frames: 46 response variables (the compositional components) and 5 explanatory variables. There are 209 observations of each. With no experience analyzing large compositions with so many parts your advice on how to plot and report results of

Re: [R] Displaying Compositional Data With 46 Parts

2015-07-17 Thread Rich Shepard
On Fri, 17 Jul 2015, Aaron Mackey wrote: One immediate question is how independent you believe the 46 components to be, and whether certain components could be reduced or otherwise coordinately-modeled; a heatmap of your 46x46 pairwise correlations should be informative. Also consider log-scalin

Re: [R] Displaying Compositional Data With 46 Parts

2015-07-17 Thread Rich Shepard
On Fri, 17 Jul 2015, John Kane wrote: I think this is more a technical question for the subject matter experts than for R-help if I am understanding the question correctly. John, I agree completely. Unfortunately, there is no R SIG devoted to CoDA, nor any other mail list or Web forum that

Re: [R] Displaying Compositional Data With 46 Parts

2015-07-17 Thread Rich Shepard
On Fri, 17 Jul 2015, John Kane wrote: Then it sounds like you are one of the experts. Do whatever you think appropriate and either set the standard for future research or get enough feedback to do even better next time. :) John, Far from an expert, but becoming more capable with each projec

Re: [R] Displaying Compositional Data With 46 Parts

2015-07-17 Thread Rich Shepard
On Fri, 17 Jul 2015, Bert Gunter wrote: I believe John Aitchison's book and papers are the authoritative basic resources. Have you read them? Bert, Yes, I have. The problem is that the support of the distributions are (hyper)simplexes, not Euclidean space, due to the requirement that the

[R] Knitr: setting echo = FALSE globally

2015-07-20 Thread Rich Shepard
Near the beginning of a LyX document I have a knitr chunk with options that begin with 'global_options', and includes echo=F. This presents the R code in that chunk from displaying in the compiled PDF file. However, all following knitr chunks are included in the PDF file. Reading the docs (in

Re: [R] Knitr: setting echo = FALSE globally

2015-07-20 Thread Rich Shepard
On Mon, 20 Jul 2015, Thierry Onkelinx wrote: Have you tried echo = FALSE instead of echo = F. If that doesn't solve your problem, please provide a minimal reproducible example. Yes, I have. Attached is a TeX file renamed to sample.txt (rather than .tex to ensure it is not stripped), a PDF

  1   2   3   4   5   6   7   8   >