Re: [R] [newbie] *apply to matching elements of n arrays?

2013-05-11 Thread Tom Roche
Tom Roche Wed, 08 May 2013 20:38:12 -0400 I have two spatial grids defined the same way (i.e., same number of rows and columns--and dimensions, both 2D). Wherever both * the value of an element i,j in the first grid is NA * the value of element i,j in the second grid is !NA I want to copy

[R] [newbie] return index(s) for value?

2013-05-11 Thread Tom Roche
not using the correct search terms). Feel free (in fact, be encouraged :-) to reply directly to me as well as to the list (I'm on the digest, which gets huge). TIA, Tom Roche tom_ro...@pobox.com __ R-help@r-project.org mailing list https://stat.ethz.ch

Re: [R] [newbie] return index(s) for value?

2013-05-11 Thread Tom Roche
https://stat.ethz.ch/pipermail/r-help/2013-May/353343.html Is there a function 'foo' such that, given an array and a value, iff the value is present in the array, it returns the index(s) of the value? E.g., matrix(1:9, nrow=3) - grid grid [,1] [,2] [,3] [1,]147 [2,]

[R] [newbie] *apply to matching elements of n arrays?

2013-05-08 Thread Tom Roche
(I'm on the digest, which gets huge). TIA, Tom Roche tom_ro...@pobox.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented

[R] [newbie] how to find and combine geographic maps with particular features?

2013-04-25 Thread Tom Roche
graphics packages (e.g., base, lattice, ggplot2)? * How to find sources (i.e., R packages, map identifiers) for arbitrary geographical and political features? TIA, Tom Roche tom_ro...@pobox.com roche@epa.gov __ R-help@r-project.org mailing list

[R] [lattice] display a projected map on a layerplot

2013-02-13 Thread Tom Roche
*does* draw a map, while the code above does not. How to fix? TIA, Tom Roche tom_ro...@pobox.com roche@epa.gov ---original example follows to end of post--- # Following adapted from what is installed in my # .../R/x86_64-pc-linux-gnu-library/2.14/m3AqfigExampleScript.r

Re: [R] code to convert 3D geographical coordinates to Cartesian?

2012-12-31 Thread Tom Roche
of formats. Doing *geospatial* statistics with *real-world data* requires the ability to transform those various formats. I consider geospatiality to be a core competency for R, and geographical - Cartesian transforms to be fundamental to that: YMMV. thanks again, Tom Roche tom_ro...@pobox.com

[R] code to convert 3D geographical coordinates to Cartesian?

2012-12-30 Thread Tom Roche
the mathematics convention that azimuth=Θ and polar angle=φ (vs the reverse physics convention). Net: the task seems straightforward enough, but there's certainly scope for error, so I'd prefer to use tested, well-used code if available. Am I missing something? TIA, Tom Roche tom_ro...@pobox.com

Re: [R] code to convert 3D geographical coordinates to Cartesian?

2012-12-30 Thread Tom Roche
. But I have looked at several packages and am not seeing it. I suspect that either it's so low-level that it's just not exposed as API, or just that there is API but I'm not seeing it in the package docs (hidden in plain sight). Hence I ask Am I missing something? TIA, Tom Roche tom_ro...@pobox.com

[R] [solved!] Re: [lattice] format and rotation of strip text

2012-11-20 Thread Tom Roche
=list(cex=0.5) ) ) # end example If there's a lattice wiki or other way to user-contribute visualization documentation, please lemme know. (For that matter, why is there not something like an r-sig-vis?) Your assistance is appreciated! Hoping this will be useful to others, Tom Roche tom_ro

[R] [lattice] how to overlay a geographical map on a levelplot?

2012-11-20 Thread Tom Roche
-contained example follows the quote above, in which I plot toy data in the sort of lattice layout I need ... except that each panel lacks a map appropriate to the spatial domain. If your competencies extend to that, your assistance would be appreciated. TIA, Tom Roche tom_ro...@pobox.com

Re: [R] [lattice] how to overlay a geographical map on a levelplot?

2012-11-20 Thread Tom Roche
https://stat.ethz.ch/pipermail/r-sig-geo/2012-November/016757.html summary: How to overlay a geographical map on each panel in a lattice (or Trellis), e.g., of levelplot's? https://stat.ethz.ch/pipermail/r-help/2012-November/329714.html Does [this] match what you are looking for? Alas, no:

[R] [solved!] [lattice] how to overlay a geographical map on a levelplot?

2012-11-20 Thread Tom Roche
https://stat.ethz.ch/pipermail/r-sig-geo/2012-November/016757.html summary: How to overlay a geographical map on each panel in a lattice (or Trellis), e.g., of levelplot's? https://stat.ethz.ch/pipermail/r-help/2012-November/329716.html you need to launch the library 'latticeExtra' That's

[R] [lattice] how to label panels with variable value (not name)?

2012-11-18 Thread Tom Roche
to before-and-after compare this to the results of a reboxing, or 3D regridding, of this data, so I would prefer instead to label each panel in the lattice with the _value_ of the level (an atmospheric pressure), rather than the name or index of the level. How to do that? TIA, Tom Roche tom_ro

[R] [lattice] format and rotation of strip text

2012-11-18 Thread Tom Roche
not seeing how; please enlighten! Your assistance is appreciated, Tom Roche tom_ro...@pobox.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html

Re: [R] [lattice] how to label panels with variable value (not name)?

2012-11-18 Thread Tom Roche
https://stat.ethz.ch/pipermail/r-help/2012-November/329454.html see ?strip.custom in lattice That showed me where to look in the lattice book: see (partial) solution to this problem, and the followup problem, @ https://stat.ethz.ch/pipermail/r-help/2012-November/329479.html Thanks! Tom Roche

Re: [R] [lattice] format and rotation of strip text

2012-11-18 Thread Tom Roche
() or signif() the values obtained from array.3d.df$lev and displayed in the strips? Your assistance is appreciated, Tom Roche tom_ro...@pobox.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] [newbie] convert 3D spatial array to dataframe

2012-11-17 Thread Tom Roche
this involves function=reshape, but I can't see how to make `reshape` work for this usecase. TIA, Tom Roche tom_ro...@pobox.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R

Re: [R] [newbie] convert 3D spatial array to dataframe

2012-11-17 Thread Tom Roche
a dataframe: am I missing something? Thanks to zero_one for offlist pointer to reshape2::melt: library(reshape2) data.frame - melt(array.3d, varnames=c(lon, lat, lev), value.name=conc) library(lattice) levelplot(conc ~ lon * lat | factor(lev), data = data.frame) works! thanks all, Tom Roche

[R] decorating API in R

2012-11-09 Thread Tom Roche
time into researching this, I thought I'd ask the community for suggestions, references, and especially examples for how to do this in R, especially how to extend one R package with another. TIA, Tom Roche tom_ro...@pobox.com __ R-help@r-project.org

[R] [newbie] failure to plot a RasterLayer with raster::plot or fields::image.plot

2012-10-21 Thread Tom Roche
the problem. Note that both output and code will remain public, hopefully to be useful to the next person attempting this sort of task. And of course I will be sure to annotate the code and project docs to give credit to whoever helps fix this! thanks in advance, Tom Roche tom_ro...@pobox.com

Re: [R] [newbie] failure to plot a RasterLayer with raster::plot or fields::image.plot

2012-10-21 Thread Tom Roche
https://stat.ethz.ch/pipermail/r-help/2012-October/326837.html summary: spatial data to be input to a regional-scale environmental model must (1) be converted to netCDF and then (2) regridded (cropped, projected, increased resolution). In a public git repository

Re: [R] R equivalent of python module structure and functionality?

2012-09-12 Thread Tom Roche
://github.com/TomRoche/GEIA_to_netCDF/commit/f982de0660b10f380183e34a0f1557a4cb1c5bb7 accordingly (to use `interactive()`, anyway). Thanks again! Tom Roche tom_ro...@pobox.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r

[R] R equivalent of python module structure and functionality?

2012-09-11 Thread Tom Roche
/module is both 1. callable from the OS commandline via, e.g., $ /path/to/cmdline.py 2. importable without mere import causing execution of the script's functionality, e.g., sys.path.append('/path/to') from cmdline import * process_command_line(...) How to do this in R? TIA, Tom Roche tom_ro

Re: [R] R equivalent of python module structure and functionality?

2012-09-11 Thread Tom Roche
/323554.html I also wanted to point Tom to CRAN packages getopt optparse written specifically to support command-line argument parsing with R Thanks, but again, I'm not seeing how those solve the given problem(s). Am I missing something? TIA, Tom Roche tom_ro...@pobox.com

Re: [R] [Rscript] difficulty passing named arguments from commandline

2012-09-09 Thread Tom Roche
://github.com/TomRoche/GEIA_to_netCDF/blob/master/netCDF.stats.to.stdout.r your assistance is appreciated, Tom Roche tom_ro...@pobox.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http

[R] [Rscript] difficulty passing named arguments from commandline

2012-09-06 Thread Tom Roche
something? Also, It Would Be Nice if there was more in the `help(Rscript)` examples about argument passing. I for one found the current examples quite terse and unhelpful. TIA, Tom Roche tom_ro...@pobox.com __ R-help@r-project.org mailing list https

Re: [R] [newbie] scripting remote check for R package

2012-09-04 Thread Tom Roche
in order to make both Rscript and R available?) 3 Is there any reason to install R without Rscript? (Alternatively, when I ask my admin to install Rscript, is there any objection I should anticipate?) your assistance is appreciated, Tom Roche tom_ro...@pobox.com

[R] how to get Rscript, and is there any reason not to?

2012-09-04 Thread Tom Roche
Rscript and R available? (FWIW I believe the boxes are running CentOS, though possibly RHEL 5 or 6.) 2 Is there any reason to install R without Rscript? Alternatively, when I ask my admin to install Rscript, is there any objection I should anticipate? TIA, Tom Roche tom_ro...@pobox.com

Re: [R] [newbie] scripting remote check for R package

2012-09-03 Thread Tom Roche
reason to install R without Rscript? (Alternatively, when I ask my admin to install Rscript, is there any objection I should anticipate?) thanks again, Tom Roche tom_ro...@pobox.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman

Re: [R] [newbie] scripting remote check for R package

2012-09-03 Thread Tom Roche
admin to do in order to make both Rscript and R available?) 3 Is there any reason to install R without Rscript? (Alternatively, when I ask my admin to install Rscript, is there any objection I should anticipate?) your assistance is appreciated, Tom Roche tom_ro...@pobox.com

[R] [newbie] scripting remote check for R package

2012-09-02 Thread Tom Roche
., EXEC_NAME='whatever' for S in 'foo' 'bar' 'baz' ; do ssh ${RSERVER} ${EXEC_NAME} --version done periodically. I'm wondering, what incantation to utter (bash preferred) via ssh to query a given server's R for a given package? TIA, Tom Roche tom_ro...@pobox.com

Re: [R] [netcdfgroup] [ncdf4] error converting GEIA data to netCDF

2012-08-28 Thread Tom Roche
Tom Roche Mon, 27 Aug 2012 23:31:23 -0400 summary: I can successfully ncvar_put(...) data to a file, but when I try to ncvar_get(...) the same data in the one and only datavar I get Error in if (nc$var[[li]]$hasAddOffset) addOffset = nc$var[[li]]$addOffset else addOffset = 0

Re: [R] [netcdfgroup] [ncdf4] error converting GEIA data to netCDF

2012-08-28 Thread Tom Roche
Pascal Oettli: MERCI BEAUCOUP! (though I would have thanked you earlier if I hadn't had to dig through the r-help digest first :-) Tom Roche Mon, 27 Aug 2012 23:31:23 -0400 summary: I can successfully ncvar_put(...) data to a file, but when I try to ncvar_get(...) the same data I get Error

Re: [R] [netcdfgroup] [ncdf4] error converting GEIA data to netCDF

2012-08-28 Thread Tom Roche
', the variable definition is prefixed with '2'. HTH, Tom Roche tom_ro...@pobox.com current GEIA.to.netCDF.r code block follows to end of post # code # process input library(maps) # on tlrPanP5 as well as clusters

Re: [R] [netcdfgroup] [ncdf4] error converting GEIA data to netCDF

2012-08-28 Thread Tom Roche
Tom Roche Tue, Aug 28, 2012 at 4:23 PM Can ncdf4 be made to fail more helpfully? E.g., to fail immediately on nc_open without assignment? David W. Pierce Tue, 28 Aug 2012 13:23:53 -0700 I'll see if there exists some way to do a better check for this. TIA. One of the many great things about

[R] [ncdf4] error converting GEIA data to netCDF

2012-08-27 Thread Tom Roche
can point to my error(s). (And, in case you're wondering: - I'm not just ncvar_put'ing the data for the exercise: I want the GEIA data in netCDF format for subsequent use. - I tried to find the GEIA data distributed in netCDF format, and asked around, but have gotten no responses. ) TIA, Tom

Re: [R] translating IDL to R

2012-07-24 Thread Tom Roche
summary: I believe I have ported the GFED IDL example routines to R (following .sig to end of post). But there are some very loose ends, notably 2 for-loops which need replaced by more R-ful code. details: Tom Roche Mon, 23 Jul 2012 21:59:54 -0400 [The GFED] example IDL code [from ftp

[R] translating IDL to R

2012-07-23 Thread Tom Roche
work. And, unfortunately, I need to generate some datasets for which instructions are provided only in IDL (see listings following my .sig). However I have R in both work environments, and love it. So if there are any experts in IDL-to-R porting out there, I'd appreciate your assistance. TIA, Tom

[R] translating IDL to R

2012-07-23 Thread Tom Roche
assistance is appreciated! Tom Roche tom_ro...@pobox.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self

[R] [fields:image.plot] subtitle under title (not image)?

2012-05-01 Thread Tom Roche
) lines(map) } else { plot(0, type=n, axes=F, xlab=, ylab=, xlim=range(x.centers), ylim=range(y.centers), main=title, sub=subtitle) lines(map) } # end testing data TIA, Tom Roche tom_ro...@pobox.com __ R-help@r-project.org mailing

Re: [R] [fields] image.plot abends with NAs in image.plot.info

2012-02-15 Thread Tom Roche
Tom Roche Fri, Feb 3, 2012 at 11:16 AM summary: image.plot-ing two sets of netCDF data, with the second derived from the first. Should have noted that the data (atmospheric emissions) in * the second dataset is heavily positively-skewed. (This leads to a problem with the legend when

[R] [newbie] separating plot output from debug output

2012-02-15 Thread Tom Roche
but kludgey. 4 No status and debug messages. I hope to be that good someday :-) Am I missing something? Are there clean solutions to this problem? TIA, Tom Roche tom_ro...@pobox.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r

Re: [R] [newbie] separating plot output from debug output

2012-02-15 Thread Tom Roche
Tom Roche Wed, 15 Feb 2012 17:43:05 -0500 1 I'm plotting to PDF, so everytime I dev.off() creates a new file, and I want everything in one file (as does my boss :-) 2 I'm doing the work on a cluster, where I very much do not have root, and which has a fairly minimal set of installed

[R] [newbie] modules.sourceforge.net and system(...) calls

2012-02-08 Thread Tom Roche
Or something completely different? 2 How to catch failure of system(...) calls, so as to fail fast? (E.g., in case I try to run the R script without setting up the modules first.) TIA, Tom Roche tom_ro...@pobox.com __ R-help@r-project.org mailing list https

Re: [R] Version control (git, mercurial) for R packages

2012-02-08 Thread Tom Roche
new to R, so I Could Be Wrong): R-forge https://r-forge.r-project.org/ seems to be the canonical place to put R packages, and it's svn. That can be finessed, e.g., http://cameron.bracken.bz/git-with-r-forge FWIW, Tom Roche tom_ro...@pobox.com __ R-help

[R] [newbie] storage/use of user's own functions?

2012-02-05 Thread Tom Roche
folder? Apologies if this is a FAQ, but I didn't see anything about it @ http://cran.r-project.org/doc/FAQ/R-FAQ.html http://cran.r-project.org/doc/manuals/R-admin.html or in casual rseek-ing. TIA, Tom Roche tom_ro...@pobox.com __ R-help@r-project.org

[R] [fields] image.plot abends with NAs in image.plot.info

2012-02-03 Thread Tom Roche
are provided. I can provide the offending dataset, but it's fairly large (638 MB). TIA, Tom Roche tom_ro...@pobox.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org

Re: [R] [ncdf] programmatically copying a netCDF file

2012-01-13 Thread Tom Roche
Tom Roche Mon, Jan 9, 2012 at 3:54 PM, I need to copy most of a source file, modifying only part, and to write a target file. David William Pierce Thu, 12 Jan 2012 09:13:53 -0800 I'd advise against doing this. I think it's the wrong approach. Better to use 'cp' to make a bit-for-bit copy

Re: [R] remoting ESS/R with tramp

2012-01-12 Thread Tom Roche
Tom Roche Thu, 12 Jan 2012 11:56:25 -0500 * I have access to the cluster [where I want to run R] configured [in .ssh/config] such that I can `ssh t` from commandline. 1 I can open an R file on the cluster with `C-x C-f /t:/home/me/onlyOrigDN2.r` from my laptop, and note the following

Re: [R] remoting ESS/R with tramp

2012-01-12 Thread Tom Roche
Tom Roche Thu, 12 Jan 2012 11:56:25 -0500 * I have access to the cluster [where I want to run R] configured [in my linux laptop's .ssh/config] such that I can `ssh t` from commandline. Note also that I'm using keychain http://www.cyberciti.biz/faq/ssh-passwordless-login-with-keychain

Re: [R] [ncdf] programmatically copying a netCDF file

2012-01-09 Thread Tom Roche
summary: Programmatically copying NetCDF mostly works: thanks for your assistance! However, 4 followup questions/responses (and motivation provided) below regarding problems encountered. details: Tom Roche Thu, 05 Jan 2012 18:29:35 -0500 I need to do surgery on a large netCDF file (technically

Re: [R] [newbie] stack operations, or functions with side effects (or both)

2012-01-05 Thread Tom Roche
[[1]] - NULL out })) mystack - Stack$new() mystack$push( 1 ) mystack$push( letters ) mystack$pop() mystack$pop() mystack$pop() # gives an error Thanks again! Tom Roche tom_ro...@pobox.com __ R-help@r-project.org mailing list https

[R] [ncdf] programmatically copying a netCDF file

2012-01-05 Thread Tom Roche
be hand-coded? TIA, Tom Roche tom_ro...@pobox.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained

[R] [newbie] stack operations, or functions with side effects (or both)

2012-01-04 Thread Tom Roche
(which I would expect)? If so, where? * How to cause the desired side effect to the argument in the code above? TIA, Tom Roche tom_ro...@pobox.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

[R] where to ask questions regarding package=ncdf?

2012-01-02 Thread Tom Roche
Should one ask questions relating to the R package 'ncdf' here? or look for a more netCDF-oriented (but probably less R-oriented) list? Why I ask: I'm relatively new to R, which I've only used in the past for graphics. I'm trying to learn R as an alternative to manipulating netCDF files with NCO

[R] [newbie] pager for large matrix?

2012-01-02 Thread Tom Roche
that will allow me to output row-wise. Is there such a tool for R? or ESS? TIA, Tom Roche tom_ro...@pobox.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting

[R] [newbie] read row from file into vector

2011-12-29 Thread Tom Roche
summary: how to read a row (not column) from a file into a vector (not a data frame)? details: I'm using $ lsb_release -ds Linux Mint Debian Edition $ uname -rv 3.0.0-1-amd64 #1 SMP Sun Jul 24 02:24:44 UTC 2011 $ R --version R version 2.14.1 (2011-12-22) I'm new to R (having previously used

Re: [R] [newbie] read row from file into vector

2011-12-29 Thread Tom Roche
Tom Roche 11-12-29 3:51 PM E.g., for a file such that $ head -n 2 ~/data/foo.csv | tail -n 1 5718,0.3,0.47,0,0,0,0,0,0,0,0,0.08,0.37,0,0,0.83,1.55,0,0,0,0,0,0,0,0,0,0.00,2.48,2.33,0.17,0,0,0,0,0,0,0.00,10.69,0.18,0,0,0,0 I'd like to be able to populate a vector 'v' s.t. v[1]=5718, ... v[43