Displaying 20 results from an estimated 6000 matches similar to: "lattice: cumsum and xyplot"
2006 Dec 08
1
lattice: defining an own function using args for "formula" and "groups"
x.fun <- function( formula, data ) dotplot( formula, data )
x.grp <- function( formula, groups, data ) dotplot( formula, groups, data )
data( barley )
> x.fun( variety ~ yield | site, data=barley )
# no problem
> dotplot( variety ~ yield | site, groups=year, data=barley )
# no problem
> x.grp( variety ~ yield | site, groups=year, data=barley )
object "year" not found
2004 Feb 12
2
lattice: showing panels for factor levels with no values
How to show panels for factor levels of conditioning variables
which do have no values?
E.g. there are panels for "Grand Rapids" when they have values:
data( barley )
with( barley, dotplot(variety ~ yield | year * site, layout=c(6,2) ) )
There are no panels for "Grand Rapids"
when there are no values for "Grand Rapids":
my.barley <- subset( barley, ! ( site ==
2010 Dec 06
2
ggplot2: Controlling line width of panel borders
Dear R-users,
i encountered some problems when trying to adjust the line width of the
axes and stripes in a plot created with ggplot2.
I use the "barley" dataset of the lattice package to illustrate my problem:
library(ggplot2)
library(lattice)
barley[["SD"]] <- 5
limits <- aes(ymax=barley$yield + barley$SD,ymin=barley$yield - barley$SD)
p1 <-
2004 Mar 10
3
converting lists got by tapply to dataframes
I have two lists:
xa <- list( X=c(1,2,3), Y=c(4,5,6), Z=c(7,8,9) )
xb <- with( barley, tapply( X=seq(1:nrow(barley)), INDEX=site
, FUN=function(z)yield[z]))
I can convert xa to a dataframe easily with:
as.data.frame(xa)
But if i try the same with xb I get:
as.data.frame(xb)
Error in as.data.frame.default(xb) :
can't coerce array into a data.frame
What
2004 Sep 13
1
Adding ranks to a repeatedly ragged array
How can I add an extra column containing the rank
to a ragged array indexed by more than one grouping
factors?
E.g. with the barley dataset:
How can I to add an additional column ``rank''
containing the rank of the ``yield'' of
the different varieties in relation to the indices
``year'' and ``site'' to the barley dataframe?
I achieved to calculate the ranks with:
2004 Mar 04
1
lattice/grid: problem with viewports for strips with zero height
PROBLEM
# Allocating strip labels by the function strip.fun():
strip.test()
# Result: No strips: ok. No strings: NOT OK.
# The distance ``y.text=unit(6,"points")'' is ignored;
# the strings are not seen on the output.
TRIALS FOR WORKAROUNDS
strip.test( strip.lines=1 )
# Result: 2 strips: ok, but not whished. 2 strings: ok.
2003 Dec 22
1
[R] lattice: levelplot: error: min not meaningful for factor (PR#6005)
R 1.8.1:
___COMMAND____________________________________________
levelplot( yield ~ year * variety | site, barley )
___ERROR_MESSAGE______________________________________
Error in Summary.factor(..., na.rm = na.rm) :
"min" not meaningful for factors
___COMMENT____________________________________________
levelplot( yield ~ as.numeric(year) * as.numeric(variety) | site,
2007 Mar 12
1
How to avoid a for-loop?
Hi all,
as I am trying to move slowly from just "working" to "good" code, I'd
like to ask if there's a smarter way than using a for-loop in tasks like
the example below.
I need to obtain the extrema of the cumulated sum of a detrended time
series. The following code is currently used, please have a look at the
comments for my questions and remarks:
system.time({
X
2004 Jan 20
1
lattice: adding text between grouped panels?
How one can add a text (e.g. the labels of an axis)
in a space between grouped panels which was created
by using the argument ``between''?
Example:
data(barley)
dotplot(variety ~ yield | site * year, data=barley,
between=list(x=c( 0, 0, 6 ))
How to add labels for the y axis in the space in the middle?
Thanks
Wolfram
2009 Sep 26
1
Lattice, stripplot (xyplot), plotting data with median line, numeric x-axis
All,
On p.52 of Deepayan Sarkar's Lattice book there is a nice plot of showing
residuals with median lines superimposed or various groups:
library("lattice")
stripplot(sqrt(abs(residuals(lm(yield~variety+year+site)))) ~ site,
data = barley, groups = year, jitter.data = TRUE, type = c("p", "a"), fun =
median)
Suppose we wanted to make a similar plot for a
2005 Oct 27
2
RSQLite problems
Hi, I'm experimenting with using (R)SQLite to do data management. Here are
two little problems that I've encountered:
1. The presence of ',' in string values causes trouble since ',' is also the
delimiter used in the SQL statement.
2. A newline '\n' line attached to the last string value of each row.
Some examples:
> library (RSQLite)
Loading required
2004 Oct 21
3
error in plot.dendrogram (PR#7300)
Hi,
hres <- hclust(smatr,method="single")
hresd<-as.dendrogram(hres)
as.dendrogram(hres)
`dendrogram' with 2 branches and 380 members total, at height 2514.513
plot(hresd,leaflab="none") #<-error here.
#the plotted dendrogram is incomplete. The x axis is not drawn.
#The interested reader can download the
save(hresd,file="hres.rda")
#from the
2010 May 07
3
How to sort a grouped barchart?
Hi,
I have a barchart very similar to the example on the function documetation,
however, I want to sort the bars according one group in one panel.
Reminding:
library(lattice)
barchart(yield ~ variety | site, data = barley,
groups = year, layout = c(1,6),
ylab = "Barley Yield (bushels/acre)", auto.key=list(),
scales = list(x = list(abbreviate = TRUE,
2004 Apr 30
2
./configure --prefix and R_LIBS
Hi!
I am installing R in non standard directory.
./configure --prefix=/non/standard/directory
The installation works fine.
But after starting R i get
.libPaths()
/usr/lib/R/library
but they cant be there of course!
Have I to set some additional switches during config?
Eryk
Dipl. bio-chem. Eryk Witold Wolski @ MPI-Moleculare Genetic
Ihnestrasse 63-73 14195 Berlin 'v'
tel:
2004 Jan 22
4
customising installed libraries
hello
I am returning to some libraries that I had previously customised by amongst
other things adding additional functions. I had simply typed these new
functions into the file in library/R/thelibrary. These however do not seem
to be loaded now as they previously were under older versions of R.
What's changed and what do i need to do?
Thanks
Stephen
2010 Mar 03
1
How to create a line and bar panel chart with two different axes?
I need to create a line and bar panel chart with two different axes. I tried
in lattice but couldn't get it worked. Here is my code:
data(barley)
barchart(yield ~ variety | site, data = barley,
groups = year, layout = c(1,6), stack = F,
auto.key = list(points = FALSE, rectangles = TRUE, space =
"right"),
ylab = "Barley Yield
2012 Nov 15
1
strip.custom() with more than one conditioning variable
Suppose I wanted to plot the barley data like this:
dotplot(variety ~ yield | year+ site, barley,
strip = strip.custom(style = 4))
The factor levels are far too long for that to be useful. I can
overcome that problem if I shorten the levels like this:
dotplot(variety ~ yield | year + site, barley,
strip = strip.custom(style = 4,
factor.levels =
2002 May 02
3
Building own packages on Windows 2000!
Hi!
I encountered some things trying to build own packages under Windows
2000 for which i found no answer in the documentation.
First.
1. I do not found the rcmd.exe in the bin directory of R_HOME.
I installed R using the setup.exe
2. I updated the R intatllation with one of the zip files. (rw1041sp.zip)
now i had the rcmd.exe in the bin.
3. I do not found any hint in the docu that perl is
2004 Sep 28
5
Bug? using { as a function in lapply
This seems like a bug to me. Can someone verify this?
First we define a function f that returns its second argument and
lapply it to 1:2 using 9 as the second argument and all seems well.
Note that "{" as a function does the same thing as f, as illustrated
with f(1,9) and "{"(1,9); however, when we attempt to use "{" in the
very same way we used f in lapply,
2006 Jul 07
2
dotplot (lattice) with panel.segments and groups
Hi,
The following produces almost exactly what I needed. The problems are
that the 'panel.dotplot' call (commented) generates the error 'Error in
NextMethod("[") : argument "subscripts" is missing, with no default'. The
other problem is that the colors alternate between the levels of the 'site'
variable, rather than 'year'.
barley$yield2