Displaying 20 results from an estimated 7000 matches similar to: "latticeExtra: useOuterStrips and axis.line$lwd"
2010 Mar 31
1
strip.custom with strip on left for three conditioning variables
I want to use a strip.custom as with useOuterStrips for three conditioning
variables.
useOuterStrips restricts this to only two conditioning variables, and I
cannot figure out
how to write strip.custom properly to do this.
library(lattice)
mtcars$HP <- equal.count(mtcars$hp)
#with two factors
x2<-xyplot(mpg ~ disp | HP + factor(cyl), mtcars)
useOuterStrips(x2)
#with three factors
2007 Jun 19
3
Controlling text and strip arrangement in xyplot
I've searched the archives and read the xyplot help but can't figure
out the 2 lattice questions below?
Consider:
library(lattice)
DF <- data.frame(x=rnorm(20), y=rnorm(20), g1=rep(letters[1:2], 10),
g2=rep(LETTERS[1:2], each=10),
g3=rep(rep(letters[3:4],each=5),2))
xyplot(y ~ x | g1 + g2, groups=g3, data=DF)
1) Is there a way to get one strip per row and column
2011 Mar 01
1
Lattice: useOuterStrips and axes
Consider the following:
library(lattice)
library(latticeExtra)
temp <- expand.grid(
subject = factor(paste('Subject', 1:3)),
var = factor(paste('Variable', 1:3)),
time = 1:10
)
temp$resp <- rnorm(nrow(temp), 10 * as.numeric(temp$var), 1)
ylimits <- by(temp$resp, temp$var, function(x) range(pretty(x)))
useOuterStrips(xyplot(
resp ~ time
2012 Oct 11
1
dotplot in ".R" with lattice & latticeExtra: proper visualization
Dear everyone,
I'm trying to do a dotplot with the libraries "lattice" and "latticeExtra".
However, no proper representation of the values on the vertical y-axis is
done by ".R". Instead of choosing the actual values of the numeric variable,
".R" plots the rank of the value. That is, there are values [375, 500, 625,
750, ..., 3000] and ".R"
2008 Jun 18
1
Custom strips in lattice
I've recently been playing with strip functions for a data presentation I'd
like to use, and have a couple questions. I've cannibalised the
useOuterStrips function from latticeExtra to give me the following sample
code:
library(lattice)
myData <- expand.grid(
type = c('First 3 days','Whole profile'),
sub = paste('Subject', 1:3,
2013 Feb 15
3
lattice 3x3 plot: force common y-limits accross rows and align x-axes
Good afternoon,
I would like to ask for help in controlling y-axis limits and labels in
lattice doplots. Unfortunately, the problem is somewhat convoluted,
please bear with the long explanation.
I would like to create a 3x3 lattice of dotplots, say subject ~ count.
The plot is conditioned on variables treatment and risk: subject ~ count
| treatment + risk. In the experiment, not all subjects
2009 Apr 09
3
Multiple Hexbinplots in 2 columns with a Single Categorical Variable
Dear Ladies and Gentlemen,
I have a fairly large database (N=13,000) and a single main categorical
discriminator between the groups.
I want to look at the time course of a number of continuous biochemical
variables over chronologic age.
Therefore I believe I need to prepare hexbinplots in two columns with simple
regression lines in them (with useOuterStrips (in library(latticeExtra) if
2013 Jan 20
2
Lattice levelplot- remove unused levels per panel
Hi,
I am using levelplot, and would like remove from each panel (condition) its
unused x levels.
e.g.
Remove from panel vs=1 the cyl level=8.
data(mtcars)
levelplot(mpg~factor(cyl)*factor(gear)|factor(vs))
Thanks for your help,
Ronny
--
View this message in context: http://r.789695.n4.nabble.com/Lattice-levelplot-remove-unused-levels-per-panel-tp4656087.html
Sent from the R help mailing
2012 Jun 25
1
combineLimits and Dates
I'm having some trouble using the latticeExtra 'combineLimits' function
with a Date x-variable:
require(lattice)
set.seed(12345)
dates <- seq(as.Date("2011-01-01"), as.Date("2011-12-31"), "days")
dat <- data.frame(d = rep(dates, 4),
g = factor(rep(rep(c(1,2), each = length(dates)), 2)),
h =
2007 Oct 01
4
how to plot a graph with different pch
I am trying to plot a graph but the points on the graph should be
different symbols and colors. It should represent what is in the legend.
I tried using the points command but this does not work. Is there
another command in R that would allow me to use different symbols and
colors for the points?
Thank you kindly.
data(mtcars)
plot(mtcars$wt,mtcars$mpg,xlab= "Weight(lbs/1000)",
2008 Aug 25
1
lattice : using both strip and strip.left
Dear all,
I'm routinely using lattice and ggplot2, I wish to create a lattice
theme that looks not too dissimilar to ggplot's defaults so I can
include both graphs in a document with a consistent look.
To illustrate my questions, consider the following example:
> library(ggplot2)
> library(lattice)
>
> # example data
> x <- seq(0, 10, len = 100)
> y1 <-
2012 Mar 15
2
Ggplot barchart drops factor levels: how to show them with zero counts?
Hello,
When plotting a barchart with ggplot it drops the levels of the factor for
which no counts are available.
For example:
library(ggplot)
mtcars$cyl<-factor(mtcars$cyl)
ggplot(mtcars[!mtcars$cyl==4,], aes(cyl))+geom_bar()
levels(mtcars[!mtcars$cyl==4,])
This shows my problem. Because no counts are available for factorlevel '4',
the label 4 dissapears from the plot. However, I
2020 Apr 16
2
suggestion: "." in [lsv]apply()
I'm sure this exists elsewhere, but, as a trade-off, could you achieve
what you want with a separate helper function F(expr) that constructs
the function you want to pass to [lsv]apply()? Something that would
allow you to write:
sapply(split(mtcars, mtcars$cyl), F(summary(lm(mpg ~ wt,.))$r.squared))
Such an F() function would apply elsewhere too.
/Henrik
On Thu, Apr 16, 2020 at 9:30 AM
2010 Aug 04
3
retrieve name of an object?
Dear all
Is there an easier way to retrieve the name of an object? For example,
> tmp <- 1:10
> as.character(quote(tmp))
[1] "tmp"
> as.character(quote(mtcars$cyl))
[1] "$" "mtcars" "cyl"
> as.character(quote(mtcars$cyl))[3]
[1] "cyl"
The last call more than anything seems a hack. Is there a better way?
Thank you
Liviu
2020 Apr 16
6
suggestion: "." in [lsv]apply()
Hi,
I would like to make a suggestion for a small syntactic modification of
FUN argument in the family of functions [lsv]apply(). The idea is to
allow one-liner expressions without typing "function(item) {...}" to
surround them. The argument to the anonymous function is simply referred
as ".". Let take an example. With this new feature, the following call
2013 Nov 23
1
ggplot o lattice contra graficar de manera clasica.
Hola, ¿qué tal?
Yo suelo utilizar los gráficos básicos de R para hacer gráficos
rápidos y, digámoslo así, para uso personal.
Sin embargo, para crear gráficos para terceros con un poco más de
"calidad" me decanto por ggplot2 (y sé que muchos otros usan lattice
con el mismo fin e idénticos resultados).
Un recurso fundamental (para mí) de ggplot2 (y lattice) es el de las
2020 Apr 16
2
suggestion: "." in [lsv]apply()
Simon,
Thanks for replying. In what follows I won't try to argue (I understood
that you find this a bad idea) but I would like to make clearer some of
your point for me (and may be for others).
Le 16/04/2020 ? 16:48, Simon Urbanek a ?crit?:
> Serguei,
>> On 17/04/2020, at 2:24 AM, Sokol Serguei <sokol at insa-toulouse.fr>
>> wrote: Hi, I would like to make a
2010 Nov 30
3
pca analysis: extract rotated scores?
Dear all
I'm unable to find an example of extracting the rotated scores of a
principal components analysis. I can do this easily for the un-rotated
version.
data(mtcars)
.PC <- princomp(~am+carb+cyl+disp+drat+gear+hp+mpg, cor=TRUE, data=mtcars)
unclass(loadings(.PC)) # component loadings
summary(.PC) # proportions of variance
mtcars$PC1 <- .PC$scores[,1] # extract un-rotated scores of
2020 Apr 17
2
suggestion: "." in [lsv]apply()
Thanks Simon,
Now, I see better your argument.
Le 16/04/2020 ? 22:48, Simon Urbanek a ?crit?:
> ... I'm not arguing against the principle, I'm arguing about your
> particular proposal as it is inconsistent and not general.
This sounds promising for me. May be in a (new?) future, R core will
come with a correct proposal for this principle?
Meanwhile, to avoid substitute(),
2020 Apr 20
1
suggestion: "." in [lsv]apply()
Le 19/04/2020 ? 20:46, Gabor Grothendieck a ?crit?:
> You can get pretty close to that already using fn$ in the gsubfn package:
>> library(gsubfn) fn$sapply(split(mtcars, mtcars$cyl), x ~
>> summary(lm(mpg ~ wt, x))$r.squared)
> 4 6 8 0.5086326 0.4645102 0.4229655
Right, I thought about similar syntax but this implementation has
similar flaws pointed by Simon, i.e. it reduces