similar to: Trellis, conditioning on more than 2 variables,

Displaying 20 results from an estimated 10000 matches similar to: "Trellis, conditioning on more than 2 variables,"

2008 Oct 27
3
Arrays of Trellis plots
hello, the example below does not work. (i know it's not supposed, but it makes it clear what i'm trying to achieve) par(mfrow=c(2,1)) xyplot(y~x2|x1,data=dataframe1,pch=20) xyplot(y~x2|x1,data=dataframe2,pch=20) i know i could probably merge the two datasets and do something like xyplot(y~x2|x1+dataset,data=merged) any other suggestion? thanks. [[alternative HTML version deleted]]
2008 Mar 21
4
difference between 2 ecdfs
hi, a) i have something like: ecdfgrp1<-ecdf(subset(mydata,TMT_GRP==1)$Y); ecdfgrp2<-ecdf(subset(mydata,TMT_GRP==2)$Y); how can i plot the difference between these 2 step functions? i could begin with ecdfrefl<-function(x){ecdfgrp2(x)-ecdfgrp1(x);} ... what next? b) if i have a vector with repeated numeric values how can i get the subset without repeated values .e.g (0,4,0,2,2)
2006 May 02
1
Call trellis function in a function (PR#8827)
Full_Name: Fan Version: 2.2.1 OS: Windows Submission from: (NULL) (159.50.101.9) Hello, When I call trellis function (such as histogram, densityplot, etc.) in a function, the call seems being ignored (no graphics is drawing) if some other instructions are placed afeter that call. Here's an example: y = rnorm(100*3) b = sample(1:3,300,replace=T) f = function() { densityplot(~y|b) }
2003 Apr 14
2
cannot create postscript files with trellis graphics inside a function
Dear People, If I define foo <-function() { x <- rnorm(500) trellis.device(postscript, file="plot.ps") densityplot(~x) dev.off() } and call foo() then plot.ps is just a blank plot. However, if I extract the lines inside foo and run them, ie. x <- rnorm(500) trellis.device(postscript, file="plot.ps") densityplot(~x) dev.off() then plot.ps is created
2008 Oct 20
2
Extracting variables with a given prefix in the parent environment
hi, get.vars.name.prefix<-function(prefix){ result<-list() len<-nchar(prefix) var.names<-ls(name=1,pattern=prefix) #name=1 probably wrong option print(var.names) for(i in 1:length(var.names)){ name<-var.names[i] field<-substr(name,len+1,nchar(name)) result[[field]]<-get(name) } result } for example x.1<-1 x.2<-2 get.vars.name.prefix("x.") should
2008 Mar 27
1
histogram for integer data
hi, library(lattice) x<-c(-1,-1,-1,0,0,0,0,1,1,2) rng<-range(x) histogram(x,endpoints=c(rng[1]-0.5,rng[2]+0.5),nint=length(unique(x))) instead of contiguous bins, i'd like spaces between them to indicate that the data is discrete, or even better, line segments positioned at integer values. i know how to do this with plot, but i need it with histogram, so that in more complicated
2012 Apr 11
1
Lattice densityplot with semitransparent filled regions
Hello, I'm doing some graphics for a paper and a need customize such with filled region above the density curve. My attempts I get something very near what I need, but I don't solve the problem of use semitransparent filled. Below a minimal reproducible code. Someone has any idea? require(lattice) # toy data... dt <- expand.grid(A=1:2, B=1:3, y=1:50) dt$y <- rnorm(nrow(dt), dt$B,
2006 Nov 24
2
low-variance warning in lmer
For block effects with small variance, lmer will sometimes estimate the variance as being very close to zero and issue a warning. I don't have a problem with this -- I've explored things a bit with some simulations (see below) and conclude that this is probably inevitable when trying to incorporate random effects with not very much data (the means and medians of estimates are plausibly
2006 Oct 25
1
density plot text
Is there any way of adding text to a density plot? I have had a go using the text() function but I think the error is because this function doesn't work with densityplot(). Alternatively, I understand I can achieve pretty much the same result if I plot a density kernel estimate using plot() (which allows text()), but I do prefer densityplot(). Also, is it possible to specify the dimensions
2004 Oct 19
3
densityplot and histogram
Is there any function like par(new=T) for lattice. I want to plot a histogram in percentages on the right hand side and also superimpose the densityplot with its density scale on the lhs. so far I am only able to do this histogram( temp[,2]~ temp[,1],nint=100,type="desnity", xlab = "Population Size", panel = function(x, ...) {
2010 Dec 15
1
Problems drawing a colored 'rug' in the Lattice 'densityplot'
Hi All, I'm trying to add a 'rug' representation of my data to a plot created with densityplot(). While I can do this in the simple case, I can't do it properly when I include the "groups" argument. I have an example below. I am running a reasonably new version of R. print(sessionInfo()) R version 2.12.0 Patched (2010-11-07 r53537) Platform: i686-pc-linux-gnu
2009 Dec 02
1
Lattice: multiple data sets on same plot
Hi, I have two data sets; one is a population and the other a sample of that population. I am trying to plot both on the same trellis display. # Example data set with two numerical attributes and two categorical pop <- data.frame(var1=rnorm(2000, 2000, 500), var2=rnorm(2000, 2000, 500)) cat<-(runif(2000)<=.5)+0 for(i in 1:length(cat)){ if(cat[i] == 0){ pop[i,"cat1"] =
2009 Jan 25
1
Multiple lattice plots on a page: aligning x-axes vertically
Dear R-help, I am creating a two lattice plots (a densityplot() and xyplot()) that have the same x-axes and then 'printing' them onto the same page, one above the other (see end of email for an example to generate the graph). With different labels on the y-axis for each plot the left spacing is different, and the x-axes don't align vertically. Although I can manually modify the
2012 Jan 17
2
Separate ablines in lattice panels
Searched archives and found some old email threads on the topic. But mot exactly what I think I need. Suppose I have a datafile such as tmp. tmp <- data.frame(var1 = c(rnorm(1000), rnorm(1000, 1, 1)), var2 = gl(2, 1000)) I'd like a plot similar to the one below, but with an abline of v=0 in the lower panel and v=1 in the upper panel. Code below creates two lines in each panel, not quite
2009 Apr 10
2
Stacked density plots
Hello R-community, I want to generate stacked density plots in lattice. My data consist of a numeric variable ('pid') that is measured in different individuals ('id'), which can be divided in two types ('type') and the measurements were repeated a different time points ('day'). I read in the Lattice book that this can be done using the 'flowViz'
2011 Dec 30
1
Lattice: Setting Conditioning Panel Order in Trellis Plots
I've looked in Deepayan Sarkar's book without finding how to specify the order of conditioning panels in a trellis plot. Here's the issue I'm trying to resolve: Sampling locations along a stream channel are not sequentially numbered. For example, the panel order for one plot (lower left to upper right, 4 panels per row): SC, SC-1, SC-100, SC-139, SC-140, SC-141, SC-145. SC-2,
2008 May 06
2
Lattice problems / cannot load lattice
Hi, My problem is simple: since having updated the lattice package, I cannot load lattice anymore. If I type in the command 'library(lattice)' the loading fails with the following message: --- cut here --- Error in library.dynam(lib, package, package.lib) : shared library 'lattice' not found In addition: Warning messages: 1: In loadNamespace(package, c(which.lib.loc,
2004 Oct 01
3
controlling colour in Trellis histogram
Hello. I am sorry for posting a (seemingly) simple question, but I have just spent 2 hours trying to find the answer, without success. I want to make a histogram with conditioning on a factor, using Trellis graphics. However, I do not want any colours (only black and white) either in the histograms or in the strip. There must be some simple argument but I can’t find it. Here is my code so
2008 Oct 17
1
R-code in Latex --- $ sign causes error
hi, here's what i have: \lstset{ basicstyle=\ttfamily, keywordstyle=\bfseries, showstringspaces=false, columns = fullflexible, mathescape = true, language=R } \begin{lstlisting} lst$val<-val \end{lstlisting} ./software.tex:16:Extra }, or forgotten \endgroup. lst$ the culprit here is the $ sign. thanks. ps: i'm posting here rather than Latex is bec i guess an R user is
2008 Oct 20
1
passing a list where names arguments are expected
hi, say i have a function f and i'd like to to call it like this: 1) f(list(a=...,b=...)) but i can't do it, because f is defined as: 2) f<-function(a=NULL,b=NULL){...} is there a way that i can approximate 1), such as mapping list(a=,...b=...) to "list(a=,...b=...)" and then replacing "list" by "f", and then evaluating the expression? thanks.