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,]1
an answer (probably because I'm 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
__
R-help@r-project.org mailing li
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
directly to me as well as the list (I'm on the digest, which gets huge).
TIA, Tom Roche
__
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.h
{
> stop(sprintf('plot.vis.layers: ERROR: cannot handle
> (length(map.list)==%i', length(map.list)))
> }
> dev.off()
> } # end plot.vis.layers
This allows me to combine US state boundaries with national boundaries
of Canada and Mexico (though only via the kludge abov
wd=0.8, col='darkgray'))
# still no map :-(
dev.off()
system(sprintf("xpdf %s", lcc.pdf))
# end example #
The data looks right, in that it greatly resembles the original
example (from which the above is adapted), which follows my .sig.
However the original-ex
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
--sample hack follows to end of post--
# Convert geogra
27;t believe that functionality this fundamental is not
API. 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
s 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?
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'
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, n
y small, quite self-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.
zation
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
__
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.
.levels=as.character(round(array.3d.df[['lev']], 3)),
strip.levels=TRUE,
horizontal=TRUE,
strip.names=FALSE ,
par.strip.text=list(cex=0.5)
)
)
Note that,
- without the line above commented out, strip values are (correctly)
all 1.123
+ with the line above
@
https://stat.ethz.ch/pipermail/r-help/2012-November/329479.html
Thanks! Tom Roche
__
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.
like the x-axis label)
+ the layer value truncated or rounded to some significant digits,
e.g., '1.1'
I suspect this can be done with strip.custom, but am not seeing how;
please enlighten!
Your assistance is appreciated, Tom Roche
__
R-help
ta.frame)
However I will need 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.
H
ot;)
library(lattice)
levelplot(conc ~ lon * lat | factor(lev), data = data.frame)
works!
thanks all, Tom Roche
__
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.
383
1015 384
1115 385
How to do that? I'm guessing this involves function=reshape, but I can't
see how to make `reshape` work for this usecase.
TIA, Tom Roche
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mail
put much scarce 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
__
R-help@r-project.or
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
> https://github.com/Tom
with
spatial plotting would take a look at the output and the code, and
diagnose 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 pro
list(
> make_option(c("-b", "--bar"), default="hello world")
> )
> opt <- parse_args(OptionParser(option_list=option_list))
> foo(bar=opt$bar)
> }
> # end foo.R ##
And I have modified my code @
https://github.com/TomRoche/GE
littler provides that Rscript doesn't--
both do hash-bang--but that's probably orthogonal to this question.)
https://stat.ethz.ch/pipermail/r-help/2012-September/323554.html
> I also wanted to point Tom to CRAN packages
> getopt
> optparse
> written specifically to supp
ript's
functionality, e.g.,
>>> sys.path.append('/path/to')
>>> from cmdline import *
>>> process_command_line(...)
How to do this in R?
TIA, Tom Roche
__
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.
gt; with them. (This is somewhat safer than using eval(parse(text=))
> because it can do less.)
Assigning arguments via strsplit() does seem to be more of a PITA, but it works
now @
https://github.com/TomRoche/GEIA_to_netCDF/blob/master/netCDF.stats.to.stdout.r
your assistance is appreciat
N2O_oceanic.nc var.name=emi_n2o
> Error in eval(expr, envir, enclos) : object '.' not found
> Calls: eval -> eval
> Execution halted
Must the quoting be so strict/brittle, or am I missing something?
Also, It Would Be Nice if there was more in the `help(Rscript)` examples
about a
both 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
ne
done
which works. I'd still like to know:
> 2 What should my admin have done to install both Rscript and R?
> (Alternatively, what should I tell my admin to do in order to make
> both Rscript and R available?)
> 3 Is there any reason to install R witho
ER} "${EXEC_PATH} CMD BATCH --slave --no-timing
${BATCH_INPUT_PATH} ${BATCH_OUTPUT_PATH}"
ssh ${RSERVER} "ls -al ${BATCH_OUTPUT_PATH}"
ssh ${RSERVER} "head -n 1 ${BATCH_OUTPUT_PATH}"
echo # newline
done
Given the pain, I'd still like to know:
> 2
natively, what should I tell my 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?)
thanks again, Tom Roche
__
E='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 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 o
to_netCDF/blob/c380c0a28dc8c71dbf0c2ba18130a2439a4fe089/GEIA.to.netCDF.r
I've also attached that (quoted) following my .sig, with the top-most
constant and function declarations removed for brevity. The dimension
definitions are prefixed with '1', the variable definition is prefixed
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(...) th
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]]$add
I tried to find the GEIA data distributed in netCDF format, and
asked around, but have gotten no responses.
) TIA, Tom Roche
__
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.
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
ounted @
http://goo.gl/QBZ3y
Your assistance is appreciated! Tom Roche
__
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 comme
ate your
assistance.
TIA, Tom Roche ---2 IDL routines follow to EOF---
from ftp://gfed3:dailyandhou...@zea.ess.uci.edu/GFEDv3.1/Readme.pdf
; idl code to generate daily emissions +
nlon=720 ; number of grid points by longitude
nlat=360 ; number of grid points by latitude
ed),
main=title, sub=subtitle)
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 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
# does dev.off()
Again, feasible 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
__
R-help@r-project.org mailing list
https://stat.e
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
(though keep in mind that
I'm 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
__
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
__
R-help@r-project.org mailing list
https://stat.ethz.c
o, the personal-functions 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
__
R-help@r-
in. image.plot.info(...) tried/failed several ways to set
values, before exiting with
> Browse[2]> info
> $xlim
> [1] NA
> $ylim
> [1] NA
> $zlim
> [1] NA
> $poly.grid
> [1] FALSE
which then causes the exception above.
How to proceed? If there's a better way t
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 us
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.cybercit
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/onlyOrigD
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 l
iple, or are there steps that must
(at least currently) necessarily be hand-coded?
TIA, Tom Roche
__
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-gui
k = NULL,
> push = function(., el) { .$stack <- c(list(el), .$stack) },
> pop = function(.) {
stopifnot(length(.$stack) > 0)
> out <- .$stack[[1]]
> .$stack[[1]] <- NULL
> out
> }))
> mystack <- Stack$new()
> mystack$push( 1 )
>
> pop2(s)
[1] 1
> print(s)
[1] 1 2 3 4 5
ditto :-( What am I missing?
* Is there already a stack API for R (which I would expect)? If so, where?
* How to cause the desired side effect to the argument in the code above?
TIA, Tom Roche
__
R-help@r-
16] [,17] [,18] [,19] [,20] [,21] [,22]
[2,] ...
...
[,291] [,292] [,293] [,294] [,295] [,296] [,297] [,298] [,299]
[2,] ...
But that's gravy: all I really want is a pager, and preferably one
that will allow me to output row-wise. Is there such a tool for R?
or ESS?
TIA, Tom Roc
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
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 a
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 i
59 matches
Mail list logo