Displaying 20 results from an estimated 11000 matches similar to: "prevent export of specific functions in NAMESPACE"
2011 Jan 31
2
identify subsets based on two grouping factors
Hi, I have a data.frame that has a categorical variable, for which I
would like to look at the distribution of levels of this variable,
based on a grouping of two other variables.
As an example:
x <- data.frame(obs=sample(c('low', 'high'),100, replace=TRUE),
grp1=sample(1:10, 100, replace=TRUE),
grp2=runif(100))
cut.grp1 <- cut(x$grp1, 3)
cut.grp2 <- cut(x$grp2, 3)
2010 Jul 27
3
xyplot with all columns of a data.frame on a single plot
Hi, I have a data.frame with columns named X, D1, D2, D3
I know I can get a single plot with 3 curves by doing
xyplot(D1 + D2 + D3 ~ X, data)
but in some cases I might have columns D1 ... D10.
Is there a way to plot all 10 columns without having to specify each
individual term?
(By analogy with formulae in lm, I thought, xyplot(. ~ X, data) would
work, but it didn't)
Thanks,
--
2010 Jul 02
2
merging plot labels in a lattice plot
Hi, I have a lattice lot conditioned on two variables. Example code is:
library(lattice)
x <- data.frame(d=runif(100),
f1=sample(c('yes', 'no'),100,replace=TRUE),
f2=c(rep('Run1',30),rep('Run2',30),rep('Run3',40)))
histogram(~d | f1 + f2, x)
In the plot, for a given value of f2, there are two panels, one for
'n'
2009 Oct 02
1
decision trees using the Hellinger distance rather than
Hi, while working with decision trees and unbalanced data, I came across the
use of the Hellinger distance as an alternative to information gain [1,2],
when dealing with skewed data. Does anybody know of R implementations of
this approach to decision trees?
Thanks,
[1] http://www.cse.nd.edu/Reports/2008/TR-2008-06.pdf
[2] http://csmr.ca.sandia.gov/~wpk/slides/wdmda-sem.pdf
--
Rajarshi Guha
NIH
2010 Dec 17
2
adding text to the top corner of a lattice plot
Hi, I have a series of lattice plots which I am arranging in a 2x2
grid via print:
print(p.preds, split=c(1,1, 2,2), more=TRUE)
print(p.comp, split=c(2,1,2,2), more=TRUE)
print(p.bw, split=c(1,2,2,2), more=FALSE)
What I'd like to have is a letter (A, B, ...) in the top corner of
each plot. While panel.text lets me add text anywhere within a plot, I
can't seem to workout how I could put
2009 Oct 16
2
using a custom color sequence for image()
Hi, I'd like to use a custom color sequence (black - low values, green -
high values) in am image() plot. While I can specify colors (say a sequence
of grays) to the col argument, the ordering is getting messed up. I have two
questions:
1. How can I get a sequence of say 256 colors starting from black and ending
in green?
2. How is this specified to image() such that it uses the colors in
2011 Jan 31
1
arranging pie charts in a matrix layout with row/col labels
Hi, I have a vector of data, that I group based on two factors via
tapply. For each such grouping I would like to plot a pie chart. I
can layout these pie charts in a matrix layout, correpsonding to the
levels of the two factors. But I am getting stuck on how to label the
rows and colums. My current approach looks like this:
x <- data.frame(obs=sample(c('low', 'high'),100,
2010 Apr 20
1
lattice code to plot columns over another variable
Hi, I've been struggling with a lattice visualiation. I have a
data.frame with 4 columns. What I'd like to have is a set of 3 panels.
Ecah panel will have the first column plotted against serial number
and then will superimpose the relevant column. My non-lattice version
is as follows:
x <- data.frame( ... )
par(mfrow=c(3,1))
for (i in 2:4) {
plot(x[,1])
points(x[,i])
}
Any
2009 Nov 19
1
problem post request with RCurl
Hi, I am trying to use a CGI service (Pubchem PUG) via RCurl and am
running into a problem where the data must be supplied via POST - but
I don't know the keyword for the argument.
The data to be sent is an XML fragment. I can do this via the command
line using curl: I save the XML string to a file called query.xml and
then do
curl -d @query.xml
2009 Sep 14
1
loading a package .Rda file at package load time
Hi, I have seen the answer to this sometime before but I just can't find it
again - pointers appreciated.
I have a package that contains some data.frames saved as .Rda files in the
data/ directory. When the package is loaded I would like to have them be
available in the workspace (without the user having to explicitly load them
using data(...)).
If my package does not use a NAMESPACE, I can
2009 Nov 18
1
converting a vector of bytes to a PNG/JPEG image
Hi, I have some code that uses rJava. One of the Java side methods returns a
byte[] representing the bytes from a PNG image.
What I'd like to do is to be able to bring up the PNG on the R side (I can
bring up a Swing window to show the PNG but I want to avoid that). I have
looked at the pixmap and rimage packages but don't seem to be able to work
out how I'd go about this (or if
2010 Nov 17
1
rasterImage and coordinate conversion
Hi, I have a plot and I would like to overlay a PNG image over it. I'm
using the rasterImage function to do this, but the problem I'm facing
is working out the coordinates of the upper right corner of the final
image in user coordinates.
That is I can place the image so the lower left is located at the
bottom of the y-axis and the left end of the x-axis. Since my image is
say 100px x
2003 Sep 03
3
plotting a distribution curves
Hi,
is there a way to plot distribution curves (say normal or chi sq etc)
from within R?
For example I looked up the *chisq family of functions but I'm not sure
as to how I would use them to generate a plot of the chi sq distribution
(for arbitrary d.o.f).
Thanks,
-------------------------------------------------------------------
Rajarshi Guha <rajarshi at presidency.com>
2009 Jun 23
2
an idiom to handle i'th element of a set of lists simultaneously
Hi, I have 3 lists, x, y, z and I'd like to perform a calculation over all
the lists simultaneously. If it were a single list I could use lapply, but
for more than one list I'm using a for loop. Is there an idiom that would
let me use something like lapply, but the function specified to lappy would
have access to an element from each list? (In Python, I would have used for
a,b,c in
2003 Mar 03
2
saving a plot to a file
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I'm a new user of R and have managed to make a plot of a histogram. Is there
any way I set the title and axes labels and then save the plot as an image
(png/gif)?
Thanks
- --
- -------------------------------------------------------------------
Rajarshi Guha <rajarshi at presidency.com> <http://jijo.cjb.net>
GPG
2012 May 02
3
strange differences in vector operation versus manual calculation
Hi, I'm running a calculation in two ways. The first way is to employ
vectors and evaluate a function in one go. The second way is to break
down the function into pieces and combine the pieces to the final
answer.
Algebraically, they should give me the same result. But the final
vector differs significantly. I must be missing something very
obvious, but I just cannot see it
xx <-
2003 Nov 10
5
attaching data to any object
Hi,
is the following possible - in a given session I make a lot of objects
and save when exiting. Usually I note down seperately what each object
is about. Is it possible to attach data to any object which would
essentially be a short note explaining the meaning of it?
Thanks,
-------------------------------------------------------------------
Rajarshi Guha <rxg218 at psu.edu>
2003 Oct 01
1
question about predictions with linear models
Hi,
this question is probably very obvious but I just cant see where I
might be going wrong.
I'm using the lm() function to generate a linear model and then make
predictions using a different set of data.
To generate the model I do (tdata & pdata are matrices of observations
and parameters, tdepv, pdepv are response vectors)
x <- as.data.frame(tdata)
x$tdepv <- tdepv
2003 Nov 10
10
shuffling a vector
Hi,
I'me trying to write a function that will shuffle a vector. At the
moment I'm baically making a vector of randomized indices and then
making a new vector from the original one using these random indices.
However, is there an alternative (more elegant) method to do this? I
tried help.search('shuffle') but it does'nt return anything relevant.
Thanks,
2007 Aug 13
4
vertically oriented color key in heatmaps
Hi, I have some data which I was plotting using image(). I wanted to
add a vertical color key to the plot and I found that heatmap.2 in
gplots does let me add a color key. However, I was thinking of a
vertical bar with the color range rather than the style that gplots
provides.
Is there any package (or code snippet) that would let me add a
vertical color key to an image() or heatmap