Displaying 20 results from an estimated 2000 matches similar to: "Identifying case by groups in a data frame"
2007 Sep 28
1
errorbar il lattice plot
Hi Everyone,
I would like to add errorbars to a lattice plot. I already have a function that
adds error bars to a plot (originally written by George Gilchrist) which takes
as arguments the coordinates of the point and then the size of the error bar. I
would like to integrate it in my lattice code but I seem to be stumped.
I can put the error bar function inside my code as if it were a panel
2005 Mar 21
1
Convert numeric to class
Dear all,
I have a script about iteration classification, like this below
data(iris)
N <- 5
ir.tr.iter <- vector('list',N)
ir.tr <- vector('list',N)
for (j in 1:N) {
ir.tr[[j]] <- rpart(Species ~., data=iris)
ir.tr.iter[j] <- ir.tr[[j]]$frame
result <- list(ir.tr=ir.tr, ir.tr.iter=ir.tr.iter)
}
as.data.frame(as.matrix(ir.tr.iter))
2006 May 31
2
a problem 'cor' function
Hi list,
One of my co-workers found this problem with 'cor' in his code and I confirm it too (see below). He's using R 2.2.1 under Win 2K and I'm using R 2.3.0 under Win XP.
===========================================
> R.Version()
$platform
[1] "i386-pc-mingw32"
$arch
[1] "i386"
$os
[1] "mingw32"
$system
[1] "i386, mingw32"
$status
2012 Jun 11
1
saving sublist lda object with save.image()
Greetings R experts,
I'm having some difficulty recovering lda objects that I've saved within sublists using the save.image() function. I am running a script that exports a variety of different information as a list, included within that list is an lda object. I then take that list and create a list of that with all the different replications I've run. Unfortunately I've been
2012 Jul 31
1
kernlab kpca predict
Hi!
The kernlab function kpca() mentions that new observations can be transformed by using predict. Theres also an example in the documentation, but as you can see i am getting an error there (As i do with my own data). I'm not sure whats wrong at the moment. I haven't any predict functions written by myself in the workspace either. I've tested it with using the matrix version and the
2008 Oct 13
2
split data, but ensure each level of the factor is represented
Hello,
I'll use part of the iris dataset for an example of what I want to
do.
> data(iris)
> iris<-iris[1:10,1:4]
> iris
Sepal.Length Sepal.Width Petal.Length Petal.Width
1 5.1 3.5 1.4 0.2
2 4.9 3.0 1.4 0.2
3 4.7 3.2 1.3 0.2
4 4.6 3.1 1.5
2011 Sep 12
5
completing missing samples
Hello,
I have a time-series that has some missing samples.
I was thinking on completing them using either zero-order hold or linear
interpolation.
I am looking for an efiicient way (other than a loop...) of identifiying the
missing time slots and filling them.
Can you think of any methods that might help here? (obviously
which(diff(time)>min(diff(time))) will give the locations, but what
2006 Jan 23
1
too-large notches in boxplot (PR #7690)
PR #7690 points out that if the confidence intervals (+/-1.58
IQR/sqrt(n)) in a boxplot with notch=TRUE are larger than the
hinges -- which is most likely to happen for small n and asymmetric
distributions -- the resulting plot is ugly, e.g.:
set.seed(1001)
npts <- 5
X <- rnorm(2*npts,rep(3:4,each=npts),sd=1)
f <- factor(rep(1:2,each=npts))
boxplot(X~f)
boxplot(X~f,notch=TRUE)
I can
2011 Jul 28
2
not working yet: Re: lattice overlay
Hi Dieter and R community:
I tried both of these three versions with ylim as suggested, none work: I
am getting only single (pch = 16) not overlayed (pch =3) everytime.
*vs 1*
require(lattice)
xyplot(Sepal.Length ~ Sepal.Width | Species , data= iris,
panel= function(x, y, subscripts) {
panel.xyplot(x, y, pch=16, col = "green4", ylim = c(0, 10))
panel.lmline(x, y, lty=4, col =
2009 Oct 17
1
Easy way to `iris[,-"Petal.Length"]' subsetting?
Dear all
What is the easy way to drop a variable by using its name (and not its
number)? Example:
> data(iris)
> head(iris)
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3.0 1.4 0.2 setosa
3 4.7 3.2 1.3 0.2 setosa
4 4.6 3.1
2008 Feb 27
2
multiple plots per page using hist and pdf
Hello,
I am puzzled by the behavior of hist() when generating multiple plots
per page on the pdf device. In the following example two pdf files
are generated. The first results in 4 plots on one pdf page as
expected. However, the second, which swaps one of the plot() calls
for hist(), results in a 4 page pdf with one plot per page.
How might I get the histogram with 3 other scatter
2005 Oct 08
1
add leading 0s to %d from png() {was Automatic creation of file names}
Dear useRs,
Is there a way to 'properly' format %d when plotting more than one
page on png()? 'Properly' means to me with leading 0s, so that the
PNGs become easy to navigate in a file/image browser. Lacking a better
solution I ended up using the code below, but would much prefer
something like
png("test_%d.png",bg="white",width=1000,height=700)
where %d
2012 Jul 23
1
duplicated() variation that goes both ways to capture all duplicates
Dear all
The trouble with the current duplicated() function in is that it can
report duplicates while searching fromFirst _or_ fromLast, but not
both ways. Often users will want to identify and extract all the
copies of the item that has duplicates, not only the duplicates
themselves.
To take the example from the man page:
> data(iris)
> iris[duplicated(iris), ] ##duplicates while
2011 Jul 30
1
grImport symbols
Dear list,
I have two questions regarding grid.symbols() in the grImport package.
This package allows you to import a vector graphic in R, and
grid.symbols() can be used to plot the resulting glyph at arbitrary
locations in a grid viewport.
I have tried the code in the grImport vignette, which is most
interesting, however I am stuck with two problems:
1- Is there a possibility to create a
2007 Mar 22
2
unexpected behavior of trellis calls inside a user-defined function
I am making a battery of levelplots and wireframes for several fitted
models. I wrote a function that takes the fitted model object as the
sole argument and produces these plots. Various strange behavior
ensued, but I have identified one very concrete issue (illustrated
below): when my figure-drawing function includes the addition of
points/lines to trellis plots, some of the
2013 Feb 13
2
sweave question
Hi Everyone: I was having trouble getting the plot size correct when
putting a plot in an sweave document. So, I searched on the internet and I
found a clever solution where the person uses
the cat function to write latex code so he can include the cat code in the
chunk and place the plot using width and height. The solution is here:
https://stat.ethz.ch/pipermail/r-help/2009-April/195094.html.
2010 Feb 03
1
Calculating subsets "on the fly" with ddply
Hi,
[I sent this to the plyr mailing list (late) last night, but it seems
to be lost in the moderation queue, so here's a shot to the broadeR
community]
Apologies in advance for being more verbose than necessary, but I'm
not even sure how to ask this question in the context of plyr, so ...
here goes.
As meaningless as this might be to do with the `iris` data, the spirit
of it is what
2007 Aug 01
1
new user question on dataframe comparisons and plots
I'm coming from the scipy community and have been using R on and for
the past week or so. I'm still feeling out the language structure,
but so far so good. I apologize in advance if I pose any obvious
questions, due to my current lack of diction when searching for my
issue, or recognizing it if I did see it.
Question 1, plots:
I have a data frame with 4 type factor columns, also in the
2012 Jul 10
3
fill 0-row data.frame with 1 line of NAs
Dear all
Is there a simpler method to achieve the following: When I obtain an
empty data.frame after subsetting, I need for it to contain one line
of NAs. Here's a dummy example:
> (.xb <- iris[ iris$Species=='zz', ])
[1] Sepal.Length Sepal.Width Petal.Length Petal.Width Species
<0 rows> (or 0-length row.names)
> dim(.xb)
[1] 0 5
> (.xa <-
2006 Mar 30
2
custom strip in lattice ignoring plotmath expressions for all but style = 1 (PR#8733)
Full_Name: Ben Tyner
Version: 2.2.0
OS: i686-pc-linux-gnu
Submission from: (NULL) (128.210.141.240)
My appologies if this has already been fixed, but I didn't see it in the
tracking system yet so I thought I'd report it. Demonstration:
xyplot(Petal.Length ~ Petal.Width | Species, iris,
strip = strip.custom(style = 1,
var.name = expression(beta),