Displaying 20 results from an estimated 100 matches similar to: "Coarsening the Resolution of a Dataset"
2005 Sep 08
1
Coarsening Factors
It is not uncommon to want to coarsen a factor by grouping levels
together. I have found one way to do this in R:
> sites
[1] F A A D A A B F C F A D E E D C F A E D F C E D E F F D B C
Levels: A B C D E F
> regions <- list(I = c("A","B","C"), II = "D", III = c("E","F"))
> library(Epi)
> region <-
2004 Mar 29
2
cut and factor
Eric,
thanks for quick reply. at first look I thought it is what I need,
but, unfortunately, it doesn't applied to original data - it
creates new data with loosing original indexes ! I want to keep indexes
of original data, but replace original data with $mids of corresponding
$breaks.
So, if I have z = 1:10, t=hist(z,plot=F)
> z
[1] 1 2 3 4 5 6 7 8 9 10
> t$breaks
[1] 0 2
2009 Jan 22
2
blowup portion of graph beside it
Hi,
I'd like to blow up portions of my graph and put it in boxes beside the
graph.Is there an addon to do this?
--
Rajesh.J
[[alternative HTML version deleted]]
2010 Feb 09
2
Resampling a grid to coarsen its resolution
Dear all,
I have a grid (data frame) dataset at 0.5 x 0.5 degrees spatial resolution (720 columns x 360 rows; regular spacing) and wish to coarsen this to a resolution of 2.5 x 2.5 degrees. A simple calculation which takes the mean of a block of points to form the regridded values would do the trick. Values which should be excluded from the calculation are -9999 (unless all points within a block
2011 Jan 03
3
optimize
Hi all,
I'm trying to get the value of y when x=203 by using the intersect of
three curves. The horizontal curve does not meet with the
other two. How can I rectify the code below?
Thanks
Muhammad
ts <- 1:10
dd <- 10:1
ts <- seq(200,209,1)
dd <- c(NA,NA,NA,NA,1.87,1.83,1.86,NA,1.95,1.96)
plot(ts,dd,ylim=c(1.5,2))
abline(lm(dd~ts),col="blue",lty=2)
2010 Mar 09
3
Fine Tuning Plotrix
Dear All,
Please see the code snippet at the end of the email.
I am using the color2D.matplot in Plotrix to plot a matrix.
It works great, but there are a few things I cannot figure out
(1) the value of cex.axis in the code snippet does not seem to affect
the final pdf at all (at least on my system, Ubuntu 9.10, plotrix and
Cairo installed from cran). How do I specify the size of the axis ticks
2012 Feb 06
0
How do I get the CEM (coarsened exact matching) package to run?
Hi,
I am running a MacBook Pro with OS X 10.6.8. When I try to load library(cem) and run any function, R crashes. Any suggestions as to why this is? Thanks in advance. I think the problem is that I don't have all the "infrastructure" I need to run CEM, but I have no clue what to do either...
#Do I have tcltk (I have no clue what that is)
capabilities("tcltk")
tcltk
2002 Feb 06
3
Help plot
Hello,
I would like plot a vector and want to specify the Xticks which will be
displayed. Is it possible ?
For example, suppose that x is a vector of length 3. I just want the
Xticks (and the corresponding labels)
for 1 2 and 3 to be displayed ( and not 1, 1.5, 2,2.5, ....) .
Thanks
--
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
Olivier MARTIN
PhD student
2010 Jun 23
5
Plotrix Trick
Dear All,
I am using the plotrix library to plot some matrices.
I have a problem: some of my data are outliers, hence using a linear
color scale does not work very well (you would see too many cells having
a similar, indistinguishable color). See the code snipped at the end of
the email.
Plotting the logarithm of the data gets the job done, but my problem is
that I would like to write in every
2001 Mar 02
1
apply on data.frame does not work properly (PR#859)
Full_Name: Dr. Sergei Zuyev
Version: 1.1.0 and 1.2.2
OS: Solaris
Submission from: (NULL) (130.159.248.36)
apply on data.frame with floats, factors and NA's does not work properly. Here
is
an example:
I am searching for rows containig NA values.
X1 <- c(1, NA)
X2<-c("A","B")
df<-data.frame(X1,X2)
apply(df,1,function(x){any(is.na(x))})
# gives
# 1 2
# FALSE
2008 May 27
1
label outliers in geom_boxplot (ggplot2)
Dear List and Hadley,
I would like to have a boxplot with ggplot2 and have the outlier values
labelled with their "name" attribute. So I did
> library(ggplot2)
> dat=data.frame(num=rep(1,20), val=c(runif(18),3,3.5),
name=letters[1:20])
> p=ggplot(dat, aes(y=val, x=num))+geom_boxplot(outlier.size=4,
outlier.colour="green")
>
2006 May 10
1
help with writing output from two different arrays to two columns in an output file
Hi,
I am very new to R and I have written the following block of code to
generate a gamma distribution for variable x (which is an array) and a
function "y" whose array values depend on the individual array values of
"x".
The code is as follows:
n=1000
x=rgamma(n,1.5,2)
y=vector("numeric",n)
for (i in 1:n){
y[i]=(2937/50000*exp(-1/1000*x[i])/x[i])
}
now I want to
2011 Jul 27
1
how to replace values in x by means in subgroups created in ... (not loops)
# Dear all,
# how to replace values in x by means in subgroups created in ...
# replace only these values where y=0 in continous sequence
# replace by mean calculated locally for each subgroup created by
# continous sequence of 0,0,0 in parallel y vector, i.e.
# where there is continous sequence of 0 in data frame vector y
# but we do not replace values in x[i], if y[i]!=0
# we do not want
2012 Apr 26
2
Lambert (1992) simulation
Hi,
I am trying to replicate Lambert (1992)'s simulation with zero-inflated
Poisson models. The citation is here:
@article{lambert1992zero,
Author = {Lambert, D.},
Journal = {Technometrics},
Pages = {1--14},
Publisher = {JSTOR},
Title = {Zero-inflated {P}oisson regression, with an application to defects
in manufacturing},
Year = {1992}}
Specifically I am trying to recreate Table 2. But my
2005 Sep 05
0
New package for grouped data models
Dear R-users,
We'd like to announce the release of our new package "grouped"
(available from CRAN), for fitting models for grouped or coarse data,
under the Coarsened At Random assumption. This is useful in cases
where the true response variable is known only up to an interval in
which it lies. Features of the package include: power calculations for
two-group comparisons,
2005 Sep 05
0
New package for grouped data models
Dear R-users,
We'd like to announce the release of our new package "grouped"
(available from CRAN), for fitting models for grouped or coarse data,
under the Coarsened At Random assumption. This is useful in cases
where the true response variable is known only up to an interval in
which it lies. Features of the package include: power calculations for
two-group comparisons,
2008 Dec 05
1
Trouble with gridBase and inset plots
Dear All,
I ma having a trouble in generating a figure containing 3 insets with
the gridBase package.
I always get an error message of the kind:
Error in gridPLT() : Figure region too small and/or viewport too large
No matter which parameters I choose. The plots works nicely with two
insets only, but when I try adding the third one, my troubles begin.
I am probably doing something wrong in the
2003 Apr 09
1
[OFF] Nested or not nested, this is the question.
Hi,
sorry by this off.
I'm still try to understand nested design.
I have the follow example (fiction):
I have 12 plots in 4 sizes in 3 replicates (4*3 = 12)
In each plot I put 2 species (A and B) to reproduce.
After a period I make samples in each board and count the number of
individuals total (tot) and individuals A and B (nsp). Others individuals
excepts A and B are in total of
2006 Dec 04
2
erroneous warning in hist (PR#9408)
Full_Name: Alex Deckmyn
Version: 2.4.0
OS: linux
Submission from: (NULL) (193.190.63.62)
specifying the "right" option in hist results in a warning when plot=F. The
option is taken into account correctly, but a warning is issued anyway. When
plot=T there is no warning.
> hist(c(1,1.5),breaks=0:4)$counts
[1] 1 1 0 0
> hist(c(1,1.5),breaks=0:4,right=T)$counts
[1] 1 1 0 0
>
2009 Jul 20
3
Histograms on a log scale
Dear All,
I would like to be able to plot histograms/densities on a semi-log or
log-log scale.
I found several suggestions online
http://tolstoy.newcastle.edu.au/R/help/05/09/12044.html
https://stat.ethz.ch/pipermail/r-help/2002-June/022295.html
http://www.harding.edu/fmccown/R/#histograms
Now, consider the code snippet taken from
http://www.harding.edu/fmccown/R/#histograms
# Get a random