Displaying 20 results from an estimated 2000 matches similar to: "color quantization / binning a variable into levels"
2004 Aug 27
1
Plotting irregular grid as image or persp
Hi,
I have an array of 2d node locations and an array triangles, and would
like to plot something like a image or persp.
An example of doing it with rgl is:
library(ncdf)
library(rgl)
# wget http://www.maplepark.com/~drf5n/extras/teapot.nc
teapot<-open.ncdf("teapot.nc")
z<-get.var.ncdf(teapot,"tris")
l<-get.var.ncdf(teapot,"locations")
2007 May 04
1
Partitioning a kde2d into equal probability areas
Hi,
I'd like to partition a 2d probability density function into regions of
equal probability. It is straightforward in the 1d case, like
qnorm(seq(0,1,length=5)) but for 2d I'd need more constraints.
Any suggestions for how to approach this? Is seems like a spatial
sampling problem but I'm not sure where to look.
Thanks for your time,
Dave
--
Dr. David Forrest
drf at
2005 Mar 22
1
sub('^','var',1:3) produces unexpected results
Hi,
According to help(sub), the ^ should match the zero-length string at the
beginning of a string:
sub('^','var',1:3) # "1" "2" "3"
sub('$','var',1:3) # "1var" "2var" "3var"
# This generates what I expected from the first case:
sub('^.','var',11:13) # "var1" "var2"
2008 Dec 11
2
how to get the CDF of a density() estimation?
Hi,
I've estimated a simple kernel density of a univariate variable with
density(), but after I would like to find out the CDF at specific
values.
How can I do it?
thanks for your help, with it I am very close to finish my first
little bit more serious work in R,
Viktor
2004 Aug 25
0
Q: how to submit documentation patches?
I don't want to gripe here, but I would like to know the best method for
submitting suggestions and patches to the documentation.
It looks like for many help items, we need to track from the html file
which help.search("*")/help("*") presents, back to the authoritiative
documentation file from which they are generated. It seems the
installation process discards much of
2005 Jun 14
0
Plotting quiver vector tensor arrows 2d field data
Hi All,
I'd like to plot something like
http://www.nawcwpns.navy.mil/~weather/mugu/mesodata/analysis.html
Looking through the galleries at
http://addictedtor.free.fr/graphiques/allgraph.php
http://r-spatial.sourceforge.net/gallery/
http://fawn.unibw-hamburg.de/cgi-bin/Rwiki.pl?GraphGallery
demo(graphics)
I did not find a function to plot a 2d field on a matrix. I did find
mention of a
2007 Jan 11
1
zero margin / marginless plots
Hi,
I'd like to produce a marginless or zero margin plot so that the pixel
coordinates represent the mathematics.
xy<-data.frame(x=c(0,1,1,0,0),y=c(0,1,0,0,1))
png('junk.png',width=300,height=300)
par(mar=c(0,0,0,0))
plot(xy$x,xy$y,xlim=c(0,1),ylim=c(,1))
dev.off()
The resultant file has about a 10 pixel margin around these lines, and I'm
not sure what parameter or function
2003 Apr 24
5
Fast R implementation of Gini mean difference
I have written the following function to calculate the weighted mean
difference for univariate data (see
http://www.xycoon.com/gini_mean_difference.htm for a related
formula). Unsurprisingly, the function is slow (compared to sd or mad)
for long vectors. I wonder if there's a way to make the function
faster, short of creating an external C function. Thanks very much
for your advice.
gmd
2007 Jan 08
1
Does strptime(...,tz="GMT") do anything?
Hi All
In trying to correlate some tide gauge data I need to deal with varying
timezones. From the documentation on strptime, it seemed that the tz
variable might have some effect on the conversion, but I'm not seeing an
effect.
> strptime("20061201 1:02 PST",format="%Y%m%d %H:%M",tz="PST")+0
[1] "2006-12-01 01:02:00 EST"
>
2005 Jun 09
1
Plot/manage spatial boundary data
I have some disconnected boundary data from a finite element ocean model
and I'd like to make a plot.
Maptools looks promising, but since my data is not in a shapefile or a
map, I'm unclear on what the best way to approach the problem.
>geom[1:10,]
lon lat depth
1 -75.42481 35.58192 16.172
2 -75.40726 35.58567 18.045
3 -75.41351 35.60312 17.333
4 -75.38888 35.58959
2003 May 20
4
Output to connections
In the document "R Data Import/Export", section "Output to connections",
there is the following portion of code:
## convert decimal point to comma in output, using a pipe (Unix)
zz <- pipe(paste("sed s/\\./,/ >", "outfile"), "w")
cat(format(round(rnorm(100), 4)), sep = "\n", file = zz)
close(zz)
## now look at the output
2010 Apr 04
4
ggplot2 geom_rect(): What am I missing here
Hi R fans,
As a newbie following the five-hour rule (after hitting my head against
the wall for five hours, post to this list), I am appealing for some
help understanding geom_rect() in ggplot2.
What I want to do is very simple. I want to generate a plot of
rectangles. Each one represents a business cycle. The x-values will be
pairs representing the start and end of each cycle. The y-values
2004 Sep 17
3
Removing constants from a data frame
Suppose I have
x<-data.frame(v1=1:4, v2=c(2,4,NA,7), v3=rep(1,4),
v4=LETTERS[1:4],v5=rep('Z',4))
or a much larger frame, and I wish to test for and remove the constant
numeric columns.
I made:
is.constant<-function(x){identical(min(x),max(x))}
and
apply(x,2,is.constant) # Works for numerics
x[,-which(apply(x,2,is.constant))]
I'd really like to be able to
2003 Jun 21
1
optim with contraints
There seems to exist peculiar cases where optim does not take care
of constraints on the parameters to be optimized over. The call to
optim is of the form
opt <- optim(cp, fn=sn.dev, gr=sn.dev.gh, method="L-BFGS-B",
lower=c(-Inf, 1e-10, -0.99527),
upper=c( Inf, Inf, 0.99527),
control=control, X=X, y=y, hessian=FALSE)
The code has worked fine
2006 Jan 23
1
mutlivariate normal and t distributions
Dear R-help list members,
I have created a package 'mnormt' with facilities for the multivariate
normal and t distributions. The core part is simply an interface to
Fortran routines by Alan Genz for computing the integral of two
densities over rectangular regions, using an adaptive integration
method. Other R functions compute densities and generate random
numbers.
The starting
2003 May 13
2
RMySQL crashes R
I have justed upgraded R v1.7.0 on Windows NT 4 and have installed the
latest RMySQL (version 0.5-1)and DBI (version 0.1-5) packages.
When I issue the following commands (tactfully adjusted) R just crashes and
disappears, any ideas?
require(RMySQL)
m <- dbDriver("MySQL")
con <- dbConnect(m, dbname="xxx", user="xxx", password="xxx",
2005 Nov 08
1
Output glm
Hello,
How can I obtain the likelihood ratio of a Poisson regression model?
Regards.
_____________________________________________
dr. Marziliano Ciro
Facolta' di Economia
Universita' degli Studi di L'Aquila
p.zza del Santuario, 19
67040 Roio Poggio, L'Aquila
tel.: 0862 434836
fax: 0862 434803
2003 Jun 10
2
fitting data to exponential distribution with glm
I am learning glm function, but how do you fit data using exponential
distribution with glm?
In the help file, under "Family Objects for Models", no ready made option
seems available for the distribution as well as for other distributions
satisfying GLM requirements not listed there.
2006 Feb 15
1
distribution fitting
Dear list,
Does anyone know how to fit the power law distribution?
I have the empirical distribution and would like to check whether it fits
the power law (with the power estimated from the data).
Any hints are appreciated.
Tanks a lot!
Galina
[[alternative HTML version deleted]]
2006 Feb 15
1
using kernel density estimates to infer mode of distribution
Hello...
Is it possible to use "density" or another kernel density estimator to
identify the mode of a distribution? When I use 'density', the resulting
density plot of my data is much cleaner than the original noisy histogram,
and I can clearly see the signal that I am interested in. E.g., suppose my
data is actually drawn from two or more normal (or other)