[R] plot one levelplot over another

2018-11-19 Thread Waichler, Scott R
Hi, I am using levelplot() to plot a primary response surface, z1. I wish to write a custom panel function that will let me plot another surface z2 = f(x,y) over z1. The second surface z2 is either NA or 1, and at locations where z2 = 1, I will use a color with low alpha to let the the z1

[R] seq() problem with chron

2018-09-06 Thread Waichler, Scott R
Hi, I encountered the problem below where the last value in the chron vector created with seq() should have a time of 15:30, but instead has 15:15. What causes this and how can I make sure that the last value in the chron vector is the same as the "to" value in seq()? library(chron) dt1 <-

[R] ggplot's aes_ doesn't work as expected for x=factor()

2017-08-13 Thread Waichler, Scott R
I'm learning how to use ggplot in a programming approach where I supply variable names on the fly. Using aes_ doesn't work as I expected when x = factor(x). Is this a bug or am I not understanding something? # toy dataset df <- data.frame(LogicalVar = c(FALSE, TRUE, FALSE, TRUE, FALSE, TRUE),

[R] plot3D color ramp not working as expected

2017-06-29 Thread Waichler, Scott R
Hi, I want to use a discrete color ramp with plot3D, and show NA values as white (default). I get unexpected results per the following. # as in help(slice3D) example: par(mfrow = c(2,2)) x <- y <- z <- seq(-1, 1, by = 0.1) grid <- mesh(x, y, z) colvar <- with(grid, x*exp(-x^2 - y^2 - z^2))

Re: [R] customizing color key with plot3D

2017-06-21 Thread Waichler, Scott R
gton, USA > -Original Message----- > From: Karline Soetaert [mailto:karline.soeta...@nioz.nl] > Sent: Wednesday, June 21, 2017 4:16 AM > To: Waichler, Scott R > Subject: RE: customizing color key with plot3D > > There is an example in the colkey help file: > >

[R] customizing color key with plot3D

2017-06-20 Thread Waichler, Scott R
Hi, I am doing composite plots with the package plot3D. One of my variables is qualitative and indexed to integers, and I would like the legend for it to have labels located at the integer values (midpoints), and not at the breaks between classes. In the example below, the Elev Classes legend

[R] how apply.monthly() in package xts works

2017-03-09 Thread Waichler, Scott R
Hi, I found that apply.monthly() in xts does not work as I expected in the case of a sparse timeseries: my.dates <- as.Date(c("1992-06-01", "1992-06-24", "1992-06-30", "1993-06-22", "1994-06-07", "1995-06-08")) my.xts <- xts(1:6, my.dates) start(my.xts) # "1992-06-24" end(my.xts) #

[R] How to 2d cross sections from a 3d finite element mesh

2015-08-10 Thread Waichler, Scott R
Hi, I have a 3D finite element mesh where each element (cell) is defined by 8 vertices. Each element is a regular polyhedron. The overall domain is a block in shape, but its horizontal principal axes are not coincident with x and y (i.e. the domain is rotated about the z-axis). I want to

[R] Can't install rgl: installed package can't be loaded; 'memory not mapped'

2015-08-08 Thread Waichler, Scott R
Hi, I can't install package rgl. The last lines from the install process talking about the error are: ** testing if installed package can be loaded sh: line 1: 11949 Segmentation fault '/files3/R/R-3.2.1_install/lib64/R/bin/R' --no-save --slave 21 '/tmp/RtmpQCpp6N/file2b115f4f8e1d'

Re: [R] Can't install rgl: installed package can't be loaded; 'memory not mapped'

2015-08-08 Thread Waichler, Scott R
Hi, I can't install package rgl. The last lines from the install process talking about the error are: I'd guess you have an OpenGL problem. Does glxgears run? Yes, it does. I wasn't aware of the program before you mentioned it, but a display opens with 3 gears and here is some

[R] write.table with append=T after using cat on same file

2015-07-27 Thread Waichler, Scott R
Hi, For years I've been writing text to the beginning of files with cat(append=F) , then following that text with data written by write.table(append=T). It is now giving me an error message. I'm using R-3.1.2. What gives? df - data.frame(x = 1, y = 1:10, z = 10:1) cat(file=junk.txt, sep=,

[R] Reading chunks of data from a file more efficiently

2014-08-09 Thread Waichler, Scott R
Hi, I have some very large (~1.1 GB) output files from a groundwater model called STOMP that I want to read as efficiently as possible. For each variable there are over 1 million values to read. Variables are not organized in columns; instead they are written out in sections in the file,

[R] Using axis limits with plot3D

2014-08-06 Thread Waichler, Scott R
I would like to use the functions in the plot3D package but I am having trouble getting the axis limits to work correctly. The slices plotted by the code below go beyond the bounds of the persp box and obscure the axis information. How can I show just the part of the domain within x.limits

Re: [R] Using apply with more than one matrix

2014-05-01 Thread Waichler, Scott R
; improper indexing for a1 } } vec - sapply(seq(length(m2)), evaluate) Scott Waichler -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Wednesday, April 30, 2014 8:46 PM To: Waichler, Scott R Cc: Bert Gunter; r-help@r-project.org Subject: Re: [R] Using

Re: [R] Using apply with more than one matrix

2014-05-01 Thread Waichler, Scott R
Sapply or mapply may work, I haven't used these much and will try to learn better how to use them. Your use of sapply looks good; but I'm trying to understand if and how I can bring in the operation on a1. This doesn't work: evaluate - function(idx) { ind.not.na -

Re: [R] Using apply with more than one matrix

2014-05-01 Thread Waichler, Scott R
will be more efficient. Thanks also to David and the others who responded to my question. It all helped. --Scott Waichler -Original Message- From: arun [mailto:smartpink...@yahoo.com] Sent: Thursday, May 01, 2014 6:24 AM To: R. Help Cc: Waichler, Scott R Subject: Re: [R] Using

[R] Using apply with more than one matrix

2014-04-30 Thread Waichler, Scott R
Hi, I want to apply a custom function to all the elements of one matrix. The function uses the value in the same i,j in a second matrix. How can I use apply() or similar function to avoid nested loops in i and j? Thanks, Scott Waichler Pacific Northwest National Laboratory Richland, WA, USA

Re: [R] Using apply with more than one matrix

2014-04-30 Thread Waichler, Scott R
] - a1[i,j,ind.not.na[1]] + m2[i,j] } } } Scott Waichler -Original Message- From: Bert Gunter [mailto:gunter.ber...@gene.com] Sent: Wednesday, April 30, 2014 12:18 PM To: Waichler, Scott R Cc: r-help@r-project.org Subject: Re: [R] Using apply with more than one matrix Scott

Re: [R] Using apply with more than one matrix

2014-04-30 Thread Waichler, Scott R
Here is a working example with no random parts. Thanks for your patience and if I'm still off the mark with my presentation I'll drop the matter. v - c(NA, 1.5, NA, NA, NA, 1.1, 0.5, NA, NA, 1.3, 0.4, 0.9) a1 - array(v, dim=c(2,2,3)) m1 - matrix(c(NA, 1.5, 2.1, NA), ncol=2,

Re: [R] problem with pip2d() from ptinpoly

2014-04-19 Thread Waichler, Scott R
Thank you for catching that, Boris. I'm surprised, given that there is no mention of sense of direction in the package documentation. Scott Waichler -Original Message- From: Boris Steipe [mailto:boris.ste...@utoronto.ca] Sent: Friday, April 18, 2014 3:49 PM To: Waichler, Scott R; r

[R] problem with pip2d() from ptinpoly

2014-04-18 Thread Waichler, Scott R
Hi, pip2d() doesn't seem to work correctly for me. I have a plot of a triangle that a query point fits inside, but the point is defined as outside the polygon by pip2d. library(ptinpoly) verts - matrix(c(594891,115309,59,117201,594891,117201), ncol=2, byrow=T) query -

[R] vector field from a 3D scalar field

2013-03-21 Thread Waichler, Scott R
I have a 3D field of a scalar variable (x, y, z, value). Is there a way to generate a vector field from this data--gradient at defined points? I found the rasterVis package for 2D data, but as yet nothing for 3D data. Thanks, Scott Waichler Pacific Northwest National Laboratory Richland, WA

[R] how to get xmlToList() to retry if http fails

2013-03-06 Thread Waichler, Scott R
Hi, I am using xmlToList() in a loop with a call to a webservice, per the code below. # Loop thru target locs for(i in 1:num.target.locs) { url - paste(sep=/, http://www.earthtools.org/timezone;, lat[i], lon[i]) tmp - xmlToList(url) df$time.offset[i] - tmp$offset

Re: [R] Can't get R to recognize Java for rJava installation

2012-04-13 Thread Waichler, Scott R
Milan, Merci. I did find the javah file and put it in /usr/bin, where R can now find it. However, I still get a similar error message when trying to install rJava, i.e. configure: error: One or more Java configuration variables are not set. The only field that doesn't have a value now are

[R] Can't read a binary file

2012-04-13 Thread Waichler, Scott R
Hi, I've read up on readBin() and chapter 6 in the R Data Import/Export manual, but I still can't read a binary file. Here is how the creator of the file described the code that would be needed in Fortran: Every record has a return in fortran. The length of each record is nx*ny*4. To read

[R] Can't get R to recognize Java for rJava installation

2012-04-12 Thread Waichler, Scott R
Hi, I am unable to install the package rJava. I tried doing what the output suggests, but it doesn't help. How can I get R to find/recognize my Java installation? I am running R-2.15.0. waichler@snow sudo R CMD javareconf Java interpreter : /usr/bin/java Java version : 1.6.0_22 Java home

Re: [R] Alternative to interp.surface() offered

2011-10-24 Thread Waichler, Scott R
This is a correction to a post from 3/10/09. I just wanted to get this in the archive. It is the same thread as http://www.mail-archive.com/r-help@r-project.org/msg48762.html Thanks to Matt Oliver for bringing this to my attention. The correct code for my.interp.surface() follows. # A

[R] How to find regions enclosed by edges within a TIF image

2011-09-16 Thread Waichler, Scott R
I am processing grayscale TIF images that represent X-rays of a sand- and gravel-filled tube. Each image represents a plane through the porous medium, and I need to classify each pixel in the image as void or solid. For the most part, voids are dark and solids are bright, but there are many

Re: [R] 3-D response surface using wireframe()

2010-04-08 Thread Waichler, Scott R
Regarding the screen argument in wireframe(), here is what I understand about how it works after much trial-and-error: After each rotation, new axes are in effect defined for the next rotation as at the start: x is to the right of the 2D view, y is towards the top, and z is positive out of

[R] Eliminate border in wireframe plot

2010-03-15 Thread Waichler, Scott R
How can I eliminate the border drawn by default around a wireframe plot? I've tried using border=NA and box=FALSE to no avail. Scott Waichler Pacific Northwest National Laboratory scott.waich...@pnl.gov __ R-help@r-project.org mailing list

[R] Cut-aways with contour3d

2010-03-15 Thread Waichler, Scott R
Luke, Thanks for your previous advice on using misc3d; I've been able to get a good start with it. Most of my colleagues use Tecplot for graphing and are wondering if I can make cut-aways using R. An example is attached. The idea is show a 3D isosurface of one property together with a 2D

[R] Screen settings for point of view in lattice and misc3d

2010-03-03 Thread Waichler, Scott R
I'm making some 3D plots with contour3d from misc3d and wireframe from lattice. I want to view them from below; i.e. the negative z-axis. I can't figure out how to do so. I would like my point of view looking up from below, with the z, y, and x axes positive going away. Can anyone tell me

Re: [R] Using contour3d: axes, plotting to file, with lattice

2010-02-12 Thread Waichler, Scott R
will be very helpful to me. Scott Waichler Pacific Northwest National Laboratory P.O. Box 999, Richland, WA 99352 scott.waich...@pnl.gov 509-372-4423, 509-341-4051 (cell) luke On Thu, 11 Feb 2010, Waichler, Scott R wrote: I am looking for examples of how to plot with contour3d

[R] Using contour3d: axes, plotting to file, with lattice

2010-02-11 Thread Waichler, Scott R
I am looking for examples of how to plot with contour3d() to a PNG or PDF file, add axes and other elements to the isosurface plot, and use contour3d in conjunction with lattice. Regarding lattice, I'm not necessarily looking for conditioning on the data shown in the isosurface plots, just a

Re: [R] Output from as.windrose() in oce package baffles me

2009-09-04 Thread Waichler, Scott R
Dan, May I ask you to report this as an issue on the oce webpage, so that others can see the discussion? (The R help is perhaps not the right place to report bugs ... and, yes, this is a bug.) http://code.google.com/p/r-oce/issues/list Yes, I will. A possible solution is

[R] Output from as.windrose() in oce package baffles me

2009-09-03 Thread Waichler, Scott R
I'm having trouble understanding the output from as.windrose(). For one thing, data on a boundary between sectors seem to be left out of the counts. I assume that explains the missing point in the output below (angle 45). Shouldn't one side of each sector interval be open, to include values

[R] RPMs for R on the Redhat EPEL site

2009-08-02 Thread Waichler, Scott R
Martyn, The maintainer of the RHEL RPMs no longer has an i386 machine running EL4, and cross-building on an x86_64 machine did not work, so I did not distribute them. As noted in a previous thread, there is a project to port the Fedora R RPMs to Enterprise Linux: On Thursday 23 April

[R] Binaries no longer compiled for RH EL4, i386?

2009-04-30 Thread Waichler, Scott R
I see that R 2.9.0 *.rpms have been compiled for RH EL5, i386 and x86_64, and also for EL4 x86_64, but not for EL4 i386. Is this an oversight or will that version no longer be compiled? Scott Waichler Pacific Northwest National Laboratory scott.waich...@pnl.gov

[R] Alternative to interp.surface() offered

2009-03-10 Thread Waichler, Scott R
I wanted a simple function for bilinear interpolation on a 2-D grid, and interp.surface() in the fields package didn't quite suit my needs. In particular, it requires uniform spacing between grid points. It also didn't have the visual reference frame I was looking for. Here is an alternative

[R] rimage doesn't install on Mac OS X 10.4

2008-11-12 Thread Waichler, Scott R
Hi, I'm trying to install rimage on a Mac OS X 10.4 machine. I followed the advice in previous R-help threads and got over the hurdles of having the header files in the right places, among other things. But I can't figure out what to do with this error.

Re: [R] Using a background photo in lattice--title and axes missing

2008-11-06 Thread Waichler, Scott R
I am trying to use a background photo in a lattice plot. I am using the rimage and TeachingDemos packages to plot the photo and translate from the photo coordinates in pixels to geographic coordinates, which is what I want to use for plotting contours, lines, etc. The (unrunable) code

[R] Using a background photo in lattice--title and axes missing

2008-11-05 Thread Waichler, Scott R
I am trying to use a background photo in a lattice plot. I am using the rimage and TeachingDemos packages to plot the photo and translate from the photo coordinates in pixels to geographic coordinates, which is what I want to use for plotting contours, lines, etc. The (unrunable) code below does

Re: [R] Using an image background with graphics

2008-10-21 Thread Waichler, Scott R
Dr. Ripley, Thank you, yes, it's the anti-aliasing thing again. I'm using Redhat EL4, R-2.8.0, and pdf(). I had the problem with images displayed in xpdf, even with xpdf -aa no. I do not get the problem in Adobe Reader 7.0 for Linux. I'll try harder to remember this point. Scott Waichler

Re: [R] Using an image background with graphics

2008-10-20 Thread Waichler, Scott R
Greg, The rimage package has functions for reading in and plotting jpeg files that you could use for displaying the photograph. If you then can find 2 points in the image (not on the same horizontal or vertical line) for which you know the coordinates in the coordinate system that you

[R] Using an image background with graphics

2008-10-13 Thread Waichler, Scott R
I would like to use a map or aerial photo as a background to plotting solid lines and text, and semi-transparent color contours, in base and lattice graphics. Plot coordinates need to be consistent with the georeferenced background. For example, a color contour plot would have an gray-toned

[R] error installing lattice package

2008-10-08 Thread Waichler, Scott R
I just updated my Redhat EL systems to R-2.7.2, and tried to update my packages as well. Lattice is one that failed. What do I need to do? R version 2.7.2 (2008-08-25) install.packages(lattice, repos = http://cran.fhcrc.org/;) Warning in install.packages(lattice, repos =

Re: [R] error installing lattice package

2008-10-08 Thread Waichler, Scott R
I just updated my Redhat EL systems to R-2.7.2, and tried to update my packages as well. Lattice is one that failed. What do I need to do? Install the R-devel RPM? (Assuming you installed R from an RPM.) Yes, I installed R from an RPM. Installing the R-devel RPM worked on one

Re: [R] Creating smooth color regions with panel.contourplot()

2008-09-18 Thread Waichler, Scott R
Thank you very much, Deepayan. There is just one more feature I'd like to get, the ability to add the contour lines. My revision to your code below prints too many lines. What needs to be changed? --Thanks, Scott Waichler [EMAIL PROTECTED] library(gridBase) library(lattice) data(volcano)

Re: [R] Creating smooth color regions with panel.contourplot()

2008-09-18 Thread Waichler, Scott R
Thank you very much, Deepayan. There is just one more feature I'd like to get, the ability to add the contour lines. My revision to your code below prints too many lines. What needs to be changed? You need to name arguments here. as.double(at) is being matched to 'nlevels', but you

Re: [R] Creating smooth color regions with panel.contourplot()

2008-09-18 Thread Waichler, Scott R
Does the contour() solution work? If not, there's not really much that can be done. Yes, I figured out how to add the naming of arguments. This works great: library(gridBase) library(lattice) data(volcano) panel.filledcontour - function(x, y, z, subscripts, at, col.regions = cm.colors,

[R] Still no R-2.7.2 rpms for Redhat Enterprise Linux

2008-09-18 Thread Waichler, Scott R
There's already an announcement about R 2.8.0, and yet there are still no R-2.7.2 binaries (rpms) for Redhat Enterprise Linux 4 and 5. Can the usual responsible party get on it? Can the system be improved to get more timely builds out on CRAN? Thanks, Scott Waichler Pacific Northwest National

[R] Parallel computing with rgenoud and snow: external file I/O possible?

2008-05-14 Thread Waichler, Scott R
I am trying to use rgenoud and snow with an external model and file I/O. Unlike the typical application of rgenoud and snow, I need to run an external executable and do pre- and post-processing of input and output files for each parameter set generated by genoud(). I'm hoping that someone can

[R] Using aggregate() and apply() on circular data

2008-01-08 Thread Waichler, Scott R
I would like to use aggregate.ts() and apply() on circular data, but I can't figure out how to get the circular data components to pass through: library(circular) x - circular(c(20, 30, 355, 5, 345, 25), units = degrees) % I want to get the mean angle for each successive pair; answer should be

[R] Range of circular data

2008-01-07 Thread Waichler, Scott R
I want to get the minimum arc (in degrees) needed to include a set of compass directions. I would like to use the range.circular() function of the package circular, because that package understands a compass-type of angle convention, but it gives results I don't understand. Howver, I can get the