Displaying 20 results from an estimated 600 matches similar to: "saving a plot to a file"
2003 Oct 28
1
stacking histograms
Hi,
I have a set of observations which are divided into two sets A and B.
I have some code that bins the dataset into 10 bins based on the max and
min of the observed values.
I would like to make a histogram of A & B using my calculated bins but
plot the distribution of B on top of A (like a stacked barplot). This is
possible since both sets A & B are binned using the same bin ranges.
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>
2004 Sep 15
1
fractal dimension of an image
Hello, I have a problem that I think can be solved in R but I'm not sure
how to tie things together.
I have a digital image of a crystal growth in 2 dimensions. And my aim
is to calculate the fractal dimension of the crystal. I was planning to
use the box counting method.
So I need to read in the image in R (for which I can use the pixmap or
rimage packages) and then draw a grid over at a
2003 Sep 14
1
title for plot contain 4 subplots
Hi,
I'm plotting 4 graphs on one page (2x2 matrix) but I cant seem to get
the title for the whole page right.
I'm doing:
op <- par(mfrow = c(2,2), pty="s")
hist(var$V2, breaks="FD",main="Euclidean Metric", xlab="Sum of 3NN ...
hist(var$V2, breaks="FD",main="Manhattan Metric", xlab="Sum of 3NN ...
hist(var$V2,
2003 Sep 15
1
question regarding ks.test()
Hi,
I'm using the ks.test() on two vectors. I looked up the reference and
also coded up a version of the two sample Smirnov test. My question is
that how can I decide from the output of R that the two vectors x & y
come from the same distribution?
Am I correct in assuming that smaller D values indicate that they come
from the same distribution? In addition how can I use the p value that
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
2006 Jun 19
2
frechet distance
Hi, is there any package (or source code snippet) that will evaluate the
Frechet distance for curves represented as sets of points?
Searching around only threw up references to a Frechet distribution.
Thanks,
-------------------------------------------------------------------
Rajarshi Guha <rxg218 at psu.edu> <http://jijo.cjb.net>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9
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,
2011 Sep 19
14
gmaps4rails "acts_as_gmappable" error
Hi all,
I started to see fun of gmaps4rails gem from
https://github.com/apneadiving/Google-Maps-for-Rails.
After everything done. When visited the locahost, i got the following
error.
undefined local variable or method `acts_as_gmappable'' for #<Class:
0x31a9da8>
the error is due to i have line "acts_as_gmappable" in my model.
Anybody knows how this is
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>
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
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,
--
2005 May 26
5
a more elegant approach to getting the majority level
Hi, I have a factor and I would like to find the most frequent level.
I think my current approach is a bit long winded and I was wondering if
there was a more elegant way to do it:
x <- factor(sample(1:0, 5,replace=TRUE))
levels(x)[ which( as.logical((table(x) == max(table(x)))) == TRUE ) ]
(The length of x will always be an odd number, so I wont get a tie in
max())
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
2003 Oct 02
4
using a string as the formula in rlm
Hi,
I am trying to build a series of rlm models. I have my data frame and
the models will be built using various coulmns of the data frame.
Thus a series of models would be
m1 <- rlm(V1 ~ V2 + V3 + V4, data)
m2 <- rlm(V1 ~ V2 + V5 + V7, data)
m3 <- rlm(V1 ~ V2 + V8 + V9, data)
I would like to automate this. Is it possible to use a string in place
of the formula?
I tried doing:
fmla
2003 Sep 16
1
calculation of the p value in ks.test()
Hi,
I'm working with the ks.test() function and I have also implemented
the test using Conover as the reference. My D value matches that
produced by R. However to calculate the p value I am using the code
described in Numerical Recipes in C++ (2nd Ed.) pg 631.
The p value produced by the NRC code is generally larger than that
produced by R by a factor of 10. Currently I am not in a position
2003 Sep 30
2
subsetting a matrix
Hi,
I'm trying to take a set of rows and columns out of a matrix. I hve
been using the index aray approach. My overll matrix is X and is 179 x
65. I want to take out 4 columns and 161 rows.
Thus I made a 161 x 2 array I and filled it up with the row,col indices.
However doing,
X[ I ] gives me a vector of the extracted elements. Is there anyway I
can coerce this into a 161 x 4 matrix?
2004 Mar 02
3
using object reference
Hi,
I have read the previous thread on using references to objects in a
function but the solution suggested does'nt seem to be working.
basically I have an object x which has an attribute a containing some
text. I would like to pass x to a function which will change the
attribute a with some new text and have the change visible when the
function exits.
something like
attr(x,'a')
2004 Feb 06
3
a grep/regexpr problem
Hi,
I'm trying to parse lines of the form:
dan001.hin (0): fingerprint={256, 411, 426, 947, 973, 976}
What I need is the sequence of number between {}. I'm using grep as
match <- grep("{([0-9,\s]*)}",s,perl=T,value=T)
where s is a character vector.
But all I get is the whole string s. I tried using regexpr in an attempt
to get just the sequence I wanted:
match <-