Re: [R] corrgram with two datasets

2013-06-27 Thread ilai
?pairs On Thu, Jun 27, 2013 at 2:48 AM, Meesters, Aesku.Kipp Institute < meest...@aesku-kipp.com> wrote: > Hi, > > I would like to display inter-parameter scatter plots like those with the > corrgram package (see upper triangle here: > http://www.statmethods.net/advgraphs/images/corrgram2.png ),

Re: [R] Optim seems not to work properly in foreach

2013-06-03 Thread ilai
On Mon, Jun 3, 2013 at 11:37 AM, Simon Zehnder ... [Some not minimal, self contained, reproducible code]... > Data simulation and thecreation of startpar works fine, but the parameters > in res$par are always the start parameters. If I run the same commands > directly on the shell I get in res$

Re: [R] highlight points in lattice cloud plot

2013-05-29 Thread ilai
On Wed, May 29, 2013 at 7:57 AM, Stefan Lüdtke wrote: > > x=runif(100, 1, 2) > y=runif(100, 2, 4) > z=runif(100, 1, 4) > > data_xyz=as.data.frame(cbind(x, y, z, a=rep(c(1:10), 10), b=rep(c(1:2), > each=50))) > > custom.panel = function(x, y, z, subscripts, ...) > { > highlight=(data_xyz$a == 1) >

Re: [R] query in plot(intervals....

2013-05-14 Thread ilai
On Tue, May 14, 2013 at 10:05 AM, Michelle Morters wrote: > Hi - > > I would like the plot ordered by intercept. > One way will be to tweak the ?intervals.lmList object require(nlme) fm1 <- intervals(lmList(distance ~ age | Subject, Orthodont)) fm2 <- fm1[order(fm1[,2,1]),,] class(fm2) <- class(

Re: [R] 3D Histograms on a Geographical Map

2013-04-19 Thread ilai
Also combining the code for figures 6.5, 13.8 and 13.9 in the following link http://lmdvr.r-forge.r-project.org/figures/figures.html gets you there. On Fri, Apr 19, 2013 at 8:38 AM, Barry Rowlingson < b.rowling...@lancaster.ac.uk> wrote: > On Fri, Apr 19, 2013 at 3:13 PM, Lorenzo Isella > wrot

Re: [R] densityplot(~x+y) for vectors of different lengths does what?

2013-02-13 Thread ilai
Hmmm... is this a (unknown or even a) bug ? Not sure this is what OP was getting at and I haven't gone through the lattice docs to see if this is mentioned, but, with unequal sizes the extended formula is not producing what one (or at least I) might expect: require(latticeExtra) set.seed(4321) ;

Re: [R] Border width on symbols plotted with the lattice package

2013-02-08 Thread ilai
On Fri, Feb 8, 2013 at 10:14 AM, David Winsemius wrote: > > On Feb 8, 2013, at 8:55 AM, ilai wrote: > > > Like this ? > > xyplot(4:5~4:5, groups=4:5, lex = 5 , > > par.settings = simpleTheme(cex=10, pch=21, lwd=5), > > auto.key=TRUE) > > > > And i

Re: [R] Border width on symbols plotted with the lattice package

2013-02-08 Thread ilai
Like this ? xyplot(4:5~4:5, groups=4:5, lex = 5 , par.settings = simpleTheme(cex=10, pch=21, lwd=5), auto.key=TRUE) On Fri, Feb 8, 2013 at 6:46 AM, Karl Ove Hufthammer wrote: > Dear list members, > > I can't figure out how get 'xyplot' or 'dotplot' in the 'lattice' package > to respect the 'lw

Re: [R] Remove and add to many matrices in list.

2013-02-05 Thread ilai
1) We don't have your previous email and I doubt anyone here committed your code to memory 2) No offense but this post is still an eye sore. Actually I am guessing even worse than the first because there is no working example. The idea is to provide *minimal* code that reproduces the problem - with

Re: [R] glm poisson and quasipoisson

2013-02-01 Thread ilai
On Thu, Jan 31, 2013 at 2:13 PM, Wim Kreinen wrote: > Hello, > > I have a question about modelling via glm. I think you are way off track. Either the data, glm, or both, are not what you think they are. > I have a dataset skn300.tab <- structure(list(n = 1:97, freq = c(0L, 0L, 0L, 0L, 1L, 7

Re: [R] different legends in lattice panels

2013-01-26 Thread ilai
On Sat, Jan 26, 2013 at 10:26 AM, Tito de Morais Luis < luis.tito-de-mor...@ird.fr> wrote: > Hi listers, > > I want to make lattice plots xyplots with the indication of legends > inside each panel with only the points and the lines actually ploted > inside each given panel according to the group(i

Re: [R] italic font for legend text when using expression function for symbols

2013-01-23 Thread ilai
plot(1) legend('topleft',legend=expression(A,italic(A),bolditalic(A),Delta*italic(D))) On Wed, Jan 23, 2013 at 9:45 AM, raz wrote: > Hello, > > I'm trying to add a symbol (Delta) to plot legend with text using > "expression(paste())" but this disables the text.font that allows to use > bold or i

Re: [R] Lattice levelplot- remove unused levels per panel

2013-01-20 Thread ilai
On Sun, Jan 20, 2013 at 1:59 AM, ronny wrote: > Hi, > > I am using levelplot, and would like remove from each panel (condition) its > unused x levels. > Uneven scales on categorical axes lead to distortion and a miss representation (as in your example - the area for levels 4,6 in vs1 will be big

Re: [R] Log scale on y axis of parallel coordinate plot (lattice)

2013-01-16 Thread ilai
On Wed, Jan 16, 2013 at 12:46 PM, ilai wrote: Oops... That's require(latticeExtra) > c(parallelplot(~ df_n, horizontal.axis = FALSE, scales=list(x = list(log = > TRUE))) , > parallelplot(~ df_n, horizontal.axis = FALSE)) > or you'll get the full printout of the two o

Re: [R] Log scale on y axis of parallel coordinate plot (lattice)

2013-01-16 Thread ilai
On Wed, Jan 16, 2013 at 12:05 PM, Patrick Connolly < p_conno...@slingshot.co.nz> wrote: > On Mon, 07-Jan-2013 at 10:21PM +1100, Roland Seubert wrote: > > |> Hello all, > |> > |> I would like to make a parallel coordinate plot with lattice. The > |> plot should have vertical log scale axes, and sho

Re: [R] overlaying zoo plots in lattice

2013-01-11 Thread ilai
str(x) ; str(y) reveals #‘zoo’ series ... # ..$ : chr [1:3] "a" "c" "b" ## HERE # Index: Date[1:100], format: "2010-01-01" "2010-01-02" "2010-01-03" "2010-01-04" ... #'data.frame':99 obs. of 3 variables: # $ ID : Factor w/ 3 levels "a","b","c": ## HERE # ..

Re: [R] Changing mtext direction, or using text for the margin?

2013-01-07 Thread ilai
On Mon, Jan 7, 2013 at 11:52 AM, David Winsemius wrote: > > If you are going that route you may want to look at the gridBase package. > > Yes for mixing base and grid graphics but IMHO overkill here. Replacing the last mtext line with grid::grid.text('dependent B', 0.985 , 0.5 , rot = 270) shoul

Re: [R] Focus on a sub-panel of a splom with trellis.focs() -- return coordinate of sub-panel, or names of variables therein

2012-12-11 Thread ilai
You could try require(grid) trellis.focus() names(iris)[round(unlist(grid.locator()))] trellis.unfocus() cheers On Tue, Dec 11, 2012 at 11:59 AM, Eric Stone wrote: > Hi, > I'd like to be able to generate a splom plot in R and then use my mouse to > click on one of the sub-panels (panel.pairs,

Re: [R] Error message R2Jags

2012-11-28 Thread ilai
On Wed, Nov 28, 2012 at 11:37 AM, alexB wrote: The error was generated by jags not R or R2Jags (wrong list). Regardless, your problem is the prior loop is only 1:6 > > > for (i in 1:6) { b[i] ~ dnorm(0.0, 0.01) > # b[i] ~ dunif(-20, +20) > So the error is literally b[

Re: [R] Problem with glm, gaussian family with log-link

2012-11-26 Thread ilai
On Mon, Nov 26, 2012 at 5:33 AM, Florian Weiler wrote: > Dear all, > > I am using the book "Generalized Linera Models and Extension" by Hardin and > Hilbe (second edition, 2007) at the moment. The authors suggest that > instead of OLS models, "the log link is generally used for response data > th

Re: [R] rjags and parallel chains

2012-11-25 Thread ilai
Specifying n >1 chains is not enough. You need some parallel backend. You can use snow/snowfall or doMC (these are R libraries) for example. Maybe others, google is your friend. Word of caution about doMC (maybe also snowfall, never tested it), you might need to specify RNG (seed, sampler) for each

Re: [R] lattice: defining grouping variable only for the upper/lower panel with splom

2012-11-19 Thread ilai
On Mon, Nov 19, 2012 at 5:42 AM, AnjaM wrote: > Using the mtcars dataset, how to define the grouping variable to be valid > only for the upper or lower panel? > > The following doesn't work: > > # Code start > > Almost : splom(~data.frame(mpg, disp, hp, drat, wt, qsec), > data=mtcars, psca

Re: [R] [newbie] convert 3D spatial array to dataframe

2012-11-17 Thread ilai
Errr... You could reshape to a long format data.frame but an arguably easier way: dimnames(array.3d) <- list(lat= 1:7 , long = 1:11 , lev = 1:5) # not needed just for clarity levelplot(array.3d) On Sat, Nov 17, 2012 at 9:36 PM, Tom Roche wrote: > > summary: how to convert a 3D array (as obtaine

Re: [R] Calculateing means

2012-11-16 Thread ilai
On Fri, Nov 16, 2012 at 2:42 PM, Khan, Sohail wrote: > Thanks. But aggregate will work on rows or columns. I need to calculate > mean for subsets of rows in a matrix > I.E. > > Indx x1 x2 x3 x4 x5 x6 x7 x8 x9 > 1 25 30 15 8 12

Re: [R] strip.custom() with more than one conditioning variable

2012-11-15 Thread ilai
dotplot(variety ~ yield | year+ site, barley, strip = function(...,which.given,factor.levels) { if(which.given==2){ strip.default(which.given,factor.levels=substr(levels(barley$site), 1, 1),style=4,...) } else{ strip.default(which.given=which.given,factor.levels=factor.levels,s

Re: [R] How to include CI in a grouped barplot?

2012-11-08 Thread ilai
On Thu, Nov 8, 2012 at 12:14 PM, Rui Barradas wrote: > Hello, > > If I understand it right, you can use the arrows() function with an angle > of 90 to get ci bars. > Using your data example, but with made up standard errors, > > > a=c(10,15) > b=c(20,24) > c=c(21,23) > > hei=cbind(a,b,c) > > # St

Re: [R] plot.new() and grid functions in multipage pdfs

2012-10-22 Thread ilai
On Fri, Oct 19, 2012 at 6:28 PM, Ali Tofigh wrote: > On Wed, Oct 17, 2012 at 4:08 PM, ilai wrote: > > On Wed, Oct 17, 2012 at 11:10 AM, Ali Tofigh > wrote: > > ## this works as intended with a mix of plot.new() and grid.newpage > pdf("test3.pdf") > p

Re: [R] plot.new() and grid functions in multipage pdfs

2012-10-17 Thread ilai
On Wed, Oct 17, 2012 at 11:10 AM, Ali Tofigh wrote: > my problem is that I usually have no choice but to mix grid and base > graphics. What does that have to do with the answer you got ? did you even try it ? here it is (again) but this time mixing base+grid: require(gridBase) pdf("test.pdf")

Re: [R] Filling points in a trellis object

2012-10-10 Thread ilai
On Wed, Oct 10, 2012 at 4:56 AM, Pierrick Bruneau wrote: > With the following code : > > dat1 <- matrix(nrow=4, ncol=2) > dat1[1,] <- c(-2, 1) > dat1[2,] <- c(-1.7, 0.9) > dat1[3,] <- c(0.1, 0.6) > dat1[4,] <- c(0.5, 0.5) > theplot <- xyplot(V2 ~ V1, as.data.frame(dat1), pch=c(4,1,5,4)) > plot(the

Re: [R] Filling points in a trellis object

2012-10-10 Thread ilai
On Wed, Oct 10, 2012 at 4:56 AM, Pierrick Bruneau wrote: > With the following code : > > dat1 <- matrix(nrow=4, ncol=2) > dat1[1,] <- c(-2, 1) > dat1[2,] <- c(-1.7, 0.9) > dat1[3,] <- c(0.1, 0.6) > dat1[4,] <- c(0.5, 0.5) > theplot <- xyplot(V2 ~ V1, as.data.frame(dat1), pch=c(4,1,5,4)) > plot(the

Re: [R] plot.new() and grid functions in multipage pdfs

2012-10-09 Thread ilai
On Tue, Oct 9, 2012 at 1:26 PM, Ali Tofigh wrote: > Hi, > > when using the grid package, I've come across this weird behaviour > > pdf("test.pdf"); plot.new(); grid.rect(gp = gpar(fill="blue")); > plot.new(); grid.rect(gp = gpar(fill="blue")); dev.off() > > The first page is filled completely wi

Re: [R] how to convert by lists in data.frames

2012-10-09 Thread ilai
actually a matrix put in as a single variable in the data.frame". Personal preference maybe but that never made sense to me in the data frame construct (even if it is just a list). Cheers > > str(by.list) > > might help here. > > -- Bert > > On Tue, Oct 9, 2012 at 11:1

Re: [R] how to convert by lists in data.frames

2012-10-09 Thread ilai
On Tue, Oct 9, 2012 at 11:42 AM, Rui Barradas wrote: > Hello, > > Try > > do.call(data.frame, by.list) > > I don't think data.frame inside do.call works in this context. May need it on the outside to do the job (Only OK here since there is no mixture of numeric and character/factors in this summa

Re: [R] Coda, HPDinterval and multiple chains

2012-10-04 Thread ilai
How about require(coda) data(line) str(line) cline <- as.mcmc(do.call(rbind,line)) str(cline) # Thus HPDinterval(cline) # (or any FUN.mcmc) sum(cline[,'alpha'] >= median(cline[,'alpha']))/nrow(cline) Cheers On Thu, Oct 4, 2012 at 12:22 PM, NORRIS Paul wrote: > Dear all, > > I'm not 100% sure

Re: [R] changing outlier shapes of boxplots using lattice

2012-09-29 Thread ilai
On Sat, Sep 29, 2012 at 7:32 AM, ilai wrote: > On Fri, Sep 28, 2012 at 11:03 PM, Elaine Kuo wrote: > >> Hello >> >> Thanks again. >> >> I got the attached graph >> Unsure why the color is still inconsistent. >> Please kindly share with your R

Re: [R] changing outlier shapes of boxplots using lattice

2012-09-29 Thread ilai
gt; "Insectivore_t", "Insectivore_w", "Insectivore_a", > "Molluscivore", "Crustacean feeder", "Omnivore") > > Please kindly help how to make the levels vertical instead of horizontal. > > Elaine > &g

Re: [R] changing outlier shapes of boxplots using lattice

2012-09-28 Thread ilai
On Fri, Sep 28, 2012 at 6:57 AM, Richard M. Heiberger wrote: > Elaine, > > For panel.bwplot you see that the central dot and the outlier dots are > controlled by > the same pch argument. ??? I don't think so... bwplot(rgamma(20,.1,1)~gl(2,10), pch=rep(17,2), panel = lattice::panel.bwplot) I th

Re: [R] Simple Question About Exporting Back to Excel

2012-09-26 Thread ilai
On Wed, Sep 26, 2012 at 3:11 PM, RCar wrote: > All, > Relatively new R user so this is probably an easy question to answer. > I am able to generate a cluster for my dataset using hclust() then ploting > the data with plot(). > This results in an image with a dendrogram with my sample names along t

Re: [R] Multiple lattice levelplots from matrices

2012-08-26 Thread ilai
You want array not list, as in levelplot(array(rnorm(400,rep(1:4,each=100)),c(10,10,4))) abind::abind is useful sometimes for binding preexisting matrices to arrays. Cheers On Sun, Aug 26, 2012 at 5:57 AM, Jens Peter Andersen / Region Nordjylland < je...@rn.dk> wrote: > Dear R-users, > > My g

Re: [R] Turn categorical array into matrix with dummy variables

2012-07-27 Thread ilai
?model.matrix On Fri, Jul 27, 2012 at 11:32 AM, xuan zhao wrote: > Hi All, > I want to turn a categorical array (array with factors) into a matrix with > dummy variables. like array=c(a,a,b,b,b) should be turned into: > a b > 1 0 > 1 0 > 0 1 > 0 1 > 0 1 > Do you know any way of doing this? > Tha

Re: [R] alternate tick labels and tick marks with lattice xyplot

2012-07-18 Thread ilai
Maybe I'm missing something too but from your example seems like you are looking for xyplot(rnorm(12) ~ 1:12 , type="l", scales=list(x=list(at=seq(2,12,2),labels=c(1, ' ', 3 , ' ' , 5 , ' ' ))), par.settings=list(axis.components=list(bottom=list(tck=c(0,1) See "scales" in ?xyplot and str(trel

Re: [R] plotting two histograms on one plot with hist function

2012-06-26 Thread ilai
,2,4),breaks=seq(0,1,.1),plot=F)$counts, hist(rbeta(30,6,8),breaks=seq(0,1,.1),plot=F)$counts), beside=T) see str(hist(yourdata)) or ?hist Cheers Ilai > John Kane > Kingston ON Canada > > > > -Original Message- > > From: mb...@sun.ac.za > > Sent: Tu

Re: [R] aligning axis labels in a colorkey from levelplot

2012-06-16 Thread ilai
On Sat, Jun 16, 2012 at 2:11 AM, Stephen Eglen wrote: > R does a great job with the fine details regarding plots. e.g in the > following: > > library(lattice) > y <- -4:4/10 > xyplot(y~1, las=1) > > No. las is a parameter in base graphics ?par. It was simply ignored here: xyplot(y~1,scales=list(

Re: [R] error calling Winbugs using R2WinBugs to run a multi-level model

2012-06-06 Thread ilai
Untested because I don't have (use) winbugs and you didn't provide dat*. But consider a <- 4 ; f <- 6 list('a','f') list(a,f) list(a=a,f=f) My guess is you wanted sp.data to be a named list, not a list of names... HTH On Wed, Jun 6, 2012 at 4:12 AM, Saana Isojunno < saana.isoju...@googlemail.co

Re: [R] how to add a vertical line for each panel in a lattice dotplot with log scale?

2012-06-06 Thread ilai
You say median for each panel but tapply gets medians for each variety (chartjunk IMHO). Regardless, *this case* has nothing to do with panel.abline. Add print(median.values) to your panel function would have hinted as to the missing piece. # medians for each panel: dotplot(variety ~ yield | site,

Re: [R] Separate Array Variable Content

2012-06-01 Thread ilai
matrices, but again I don't really understand what you're after. Sorry. Ilai On Fri, Jun 1, 2012 at 12:53 AM, Akkara, Antony (GE Energy, Non-GE) < antony.akk...@ge.com> wrote: > Hi iLai, > > ** ** > > What you showed below, almost same like I am al

Re: [R] Separate Array Variable Content

2012-05-30 Thread ilai
If you haven't done so you *must* read an Introduction to R. The only reason this is a problem is Myarray is a character string, not a function or expression to be evaluated. I think this will get you what you want though: # In the future use the output of ?dput to provide data to this list (MyMa

Re: [R] lattice: add a marginal histogram on top of the colorkey of a levelplot?

2012-05-29 Thread ilai
?plot.trellis. In general something like mlp<- levelplot(... mhist<- histogram(... plot(mlp,split=c(1,2,1,2),more=T) plot(mhist,split=c(1,1,1,2),more=F) You will need to do some work on the padding and layout widths to get the distances right (I assume the key is to be the "x-axis" of the histogr

Re: [R] glm(weights) and standard errors

2012-05-25 Thread ilai
I'm confused (I bet David is too). First and last models are "the same", what do SE's have to do with anything ? naive <- glm(extra ~ group, data=sleep) imputWrong <- glm(extra ~ group, data=sleep10) imput <- glm(extra ~ group, data=sleep10,weights=rep(0.1,nrow(sleep10))) lapply(list(naive,imputWr

Re: [R] Manually modifying an hclust dendrogram to remove singletons

2012-05-24 Thread ilai
Can't put my finger on it but something about your idea rubs me the wrong way. Maybe it's that the tree depends on the hierarchical clustering algorithm and the choice on how to trim it should be based on something more defensible than "avoid singletons". In this example Hawaii is really different

Re: [R] Lattice: Add abline to Single Value qqmath() Plot

2012-05-15 Thread ilai
On Tue, May 15, 2012 at 4:19 PM, Rich Shepard wrote: > On Tue, 15 May 2012, David L Carlson wrote: > > David, > >  I have 130 plots to produce (30 chemicals un-transformed and three > transformations). The R console insists that I retype each of the 6 lines > (adding a prepanel.qqmathline line) ea

Re: [R] Lattice side by side boxplots with average

2012-05-08 Thread ilai
On Tue, May 8, 2012 at 9:32 AM, maxbre wrote: > and then with the superposition of relative average values to the boxplots, > i.e. something like: > > panel.points(…, mean.values, ..., pch = 17) Almost. You need to give panel.points the new x, and make sure the right mean.values go to the right

Re: [R] error bars for a barchart

2012-05-01 Thread ilai
Thank you for your example. I only skimmed it, but since both solutions use nlevels and box.ratio it is no surprise we end up at the same place (although I do think your g-median is nicer than my 3/4). Thing is, I wouldn't call either of these "simple"... would be nice if one could just query the

Re: [R] error bars for a barchart

2012-05-01 Thread ilai
Hi, I think the issue is not "respecting the groups" but finding the x-location of the center of bars in panel.barchart(groups,...). Don't know about the memisc package, but doesn't look like it provides an easy solution. This is how I do it: http://www.mail-archive.com/r-help@r-project.org/msg1622

Re: [R] Create new Vector based on two colums

2012-04-25 Thread ilai
On Wed, Apr 25, 2012 at 6:14 AM, Patrick Hausmann wrote: > Hello, > > I am trying to get a new vector 'x1' based on the not NA-values in column > 'a' and 'b'. I found a way but I am sure this is not the best solution. So > any ideas on how to "optimize" this would be great! If by optimize you mea

Re: [R] automating a script to read a file

2012-04-24 Thread ilai
le to you. Best > > Steve > > On Apr 24, 2012 7:45 PM, "ilai" wrote: >> >> On Tue, Apr 24, 2012 at 2:09 PM,   wrote: >> >> > library(latticeExtra) >> >> doubleYScale(hist("mydata", breaks=20, prob=T,  xlim=c(-100, 2000),

Re: [R] automating a script to read a file

2012-04-24 Thread ilai
On Tue, Apr 24, 2012 at 2:09 PM, wrote: > library(latticeExtra) >> doubleYScale(hist("mydata", breaks=20, prob=T,  xlim=c(-100, 2000), > plot.spdf(x), use.style=FALSE) > > This does not work as doubleYScale expects histogram and densityplot,  and > I'd like to use the plot.spdf routine in its pl

Re: [R] Remove top/right border from lattice plots

2012-04-24 Thread ilai
You need to do a little more work to add the components you want "back in". I think you want something like: xyplot( Sepal.Length ~ Petal.Length, auto.key=T, data=iris, par.settings = list(axis.line = list(col = 0)),scales=list(col=1,tck=c(1,0)), panel=function(...){ lims <- current.panel.lim

Re: [R] Fwd: User defined panel functions in lattice

2012-04-20 Thread ilai
On Fri, Apr 20, 2012 at 8:15 PM, David Winsemius wrote: > > Another puzzle. In the original posting there was this segment: > --- > > but gives an error message without par.settings if i want to add >                       panel.Locfit(x,y,nn= 0.9,lwd = c(1,2,3), ...) > > Error using packet 1 > fo

Re: [R] Fwd: User defined panel functions in lattice

2012-04-20 Thread ilai
Oops - that is "reply all" On Fri, Apr 20, 2012 at 5:29 PM, David Winsemius wrote: > > I'm a bit puzzled by this exchange. I know there is a 'panel.locfit', but > you two are spelling it differently. Can you explain why you are doing so? > Hi David, Thanks for stepping in. panel.Locfit is the OP'

Re: [R] Fwd: User defined panel functions in lattice

2012-04-20 Thread ilai
Duncan, First off, I admit it is not clear to me what you are trying to achieve and more importantly, why? by "why" I mean 1) I don't see the advantage of writing one general panel function for completely different situations (one/multiple smoothers, grouping levels etc.) 2) your intended result as

[R] Fwd: User defined panel functions in lattice

2012-04-19 Thread ilai
On Thu, Apr 19, 2012 at 2:30 AM, Duncan Mackay wrote: > Hi > >  xyplot(y ~x|Farm,xx, >         groups = Padd, >         panel = panel.superpose, >         panel.groups=function(x,y, ...){ >                        panel.Locfit(x,y,...) >                        panel.xyplot(x,y,...) >              

Re: [R] Displaying data in Trellis

2012-04-19 Thread ilai
On Thu, Apr 19, 2012 at 2:55 AM, ce41188 wrote: > Thank you for the reply. > > The more I look at this, the more confused I become. I was wondering if you > could walk me through this a little more in detail, in particular the panel > method function of doing things. It may be obvious to many, but

Re: [R] how to plot separate lm ablines on the same xyplot by group

2012-04-18 Thread ilai
On Wed, Apr 18, 2012 at 2:07 PM, Louis Plough wrote: > If you could lead me to an example with code, that would help me figure out > how to do it for my function The states example in ?xyplot uses groups and subscripts in a panel function >> I read it, but I guess I don't quite understand which

Re: [R] Displaying data in Trellis

2012-04-18 Thread ilai
On Wed, Apr 18, 2012 at 8:45 AM, slavrenz wrote: I would like to display with the xyplot() function > for several states. I will have a total of 6 plots, I need to plot the > points of one of the states in a different color than all the rest, such > that they can be more easily referenced in a p

Re: [R] Help with vectorization

2012-04-12 Thread ilai
Michael originally suggested ?outer. I think that was enough in this case (no need for mv or sapply): wlpk3 <- outer(k3,wl,'+') ln.phiDIC <- log(k1)+k2/wlpk3 phiDIC<- t(exp(ln.phiDIC)) colnames(phiDIC)<- stations str(phiDIC) Cheers On Thu, Apr 12, 2012 at 8:58 PM, R. Michael Weylandt wrote: >

Re: [R] xyplot lattice fine control of axes limits and thick marks (with log scale)

2012-04-11 Thread ilai
On Wed, Apr 11, 2012 at 7:16 AM, David Winsemius wrote: > > On Apr 11, 2012, at 9:03 AM, David Winsemius wrote: > >> >> On Apr 11, 2012, at 6:28 AM, maxbre wrote: >> >>> hi, I just realised I want to go a little further in the control of the >>> chart >>> appearance and I would like to have the sa

Re: [R] Lattice densityplot with semitransparent filled regions

2012-04-11 Thread ilai
densityplot(~y|B, groups=A, data=dt, plot.points="rug", col=trellis.par.get("superpose.polygon")$col, alpha=.5, panel=panel.superpose, panel.groups=my.panel.densityplot) Worked for me (i.e. semi-transparent superpose.polygon colors). Is that not wha

Re: [R] Gradients in bar charts XXXX

2012-04-09 Thread ilai
On Mon, Apr 9, 2012 at 12:40 PM, Jason Rodriguez wrote: > Hello, I have a graphics-related question: > > I was wondering if anyone knows of a way to create a bar chart that is > colored with a three-part gradient that changes at fixed y-values. Each bar > needs to fade green-to-yellow at Y=.10 a

Re: [R] filling the matrix row by row in the order from lower to larger elements

2012-04-08 Thread ilai
on any ncol(matrix). Using apply was suggested at some point by others, my comment was simply that you failed to meet even that adjustment. Cheers > On Fri, Apr 6, 2012 at 6:59 PM, ilai wrote: >> On Fri, Apr 6, 2012 at 4:02 PM, Dimitri Liakhovitski >> wrote: >>  This w

Re: [R] axis labels not showing

2012-04-08 Thread ilai
On Sun, Apr 8, 2012 at 11:40 AM, Vikram Chhatre wrote: > Hello - > > I want to generate stacked plots with par(mfrow)) function.  However, > my axis labels aren't showing. > Your mar (2) are too narrow. You could increase back to the default or use the lines option in mtext to write labels closer

Re: [R] xyplot() does not plot legends with "relation=free" scales

2012-04-08 Thread ilai
On Sun, Apr 8, 2012 at 3:42 AM, Kaveh Vakili wrote: > Hi all, > > I have this problem with lattice that xyplot() won't draw some of my axis > labels if the type (i.e. the relation argument) of scales is set as free. For > example, in the plot below, I would want it to also show: > > 1. the label

Re: [R] Drawing a line in xyplot

2012-04-08 Thread ilai
On Sat, Apr 7, 2012 at 8:29 PM, wcheckle wrote: > Thank you David, the bwplot option does what I need: > However, I am interested in also learning how to do it in xyplot as well.  I > wasn’t able to follow the last two set of instructions That was me. Sorry for any confusion. wcheckle, these we

Re: [R] Drawing a line in xyplot

2012-04-07 Thread ilai
On Sat, Apr 7, 2012 at 11:16 AM, David Winsemius wrote: > xyplot(mortality ~ type, data=xdat, >               panel=function(x,y){ >                   panel.xyplot(x,y, jitter.x=TRUE) >                   panel.segments(x0=c(.9, 1.9, 2.9), >                                   x1=c(1.1,2.1,3.1), >  

Re: [R] filling the matrix row by row in the order from lower to larger elements

2012-04-06 Thread ilai
On Fri, Apr 6, 2012 at 4:02 PM, Dimitri Liakhovitski wrote: This works great: Really ? surprising given it is the EXACT same for-loop as in your original problem with counter "i" replaced by "k" and reorder to matrix[!100]<- 0 instead of matrix(0)[i]<- 100 You didn't even attempt to implement Ca

Re: [R] filling the matrix row by row in the order from lower to larger elements

2012-04-06 Thread ilai
I maybe missing something but this seems like an indexing problem which doesn't require a loop at all. Something like this maybe? (input<-matrix(c(5,1,3,7,2,6,4,8),nc=2)) output <- matrix(0,max(input),2) output[input[,1],1] <- 100 output[input[,2],2] <- 100 output Cheers On Fri, Apr 6, 2012 at

Re: [R] Changing grid defaults

2012-04-06 Thread ilai
You might want to check out package {tikzDevice} and it's documentation. In essence you turn your R plots to tikz-pgf so they can be naturally incorporated into a beamer presentation. Colors, bg, fonts etc. can now be controlled in your main latex doc. I find it much more convenient, and nicer when

Re: [R] indexing data.frame columns

2012-04-05 Thread ilai
On Thu, Apr 5, 2012 at 1:40 PM, Peter Meilstrup wrote: > Consider the data.frame: > > df <- data.frame(A = c(1,4,2,6,7,3,6), B= c(3,7,2,7,3,5,4), C = > c(2,7,5,2,7,4,5), index = c("A","B","A","C","B","B","C")) > > I want to select the column specified in 'index' for every row of 'df', to > get > >

Re: [R] cluster analysis with pairwise data

2012-04-04 Thread ilai
On Wed, Apr 4, 2012 at 10:12 AM, Petr Savicky wrote: > On Wed, Apr 04, 2012 at 01:32:10PM +0200, paladini wrote: >  Var1 <- c("(1,2)", "(7,8)", "(4,7)") >  Var2 <- c("(1,5)", "(3,88)", "(12,4)") >  Var3 <- c("(4,2)", "(6,5)", "(4,4)") >  DF <- data.frame(Var1, Var2, Var3, stringsAsFactors=FALSE)

Re: [R] image.plot adding x-axis labels. Please Help

2012-04-04 Thread ilai
glers, the same solution can be achieved with A<- matrix(1:50,nr=10) par(mar=c(5.1,2.1,4.1,4.1)) image(t(A),axes=F,col='transparent') axis(1,at=seq(0,1,l=ncol(A)),labels=LETTERS[1:ncol(A)]) require(fields) image.plot(t(A),add=T,legend.mar=3.1) Cheers > >> >> >>

Re: [R] A contour plot question - vis.gam () function in "mgcv"

2012-04-04 Thread ilai
On Tue, Apr 3, 2012 at 6:22 PM, Peter Ehlers wrote: > On 2012-04-03 15:49, ilai wrote: >> >> Try to plot the points first followed by vis.gam(...,type='contour', >> color='bw', add=T) instead of vis.gam followed by points. >> >> HTH > >

Re: [R] image.plot adding x-axis labels. Please Help

2012-04-03 Thread ilai
On Tue, Apr 3, 2012 at 7:25 PM, David Lyon wrote: > if I had a data file like this: > 1.42 1.29 -0.13 > 1.46 1.34 -0.12 > 1.45 1.32 -0.13 > 1.36 1.26 -0.10 > 1.33 1.29 -0.04 > > I want to create a image plot like this: > data1<-read.table("A") > > image.plot(t(data1), axes=FALSE, xlab=NA, ylab=NA)

Re: [R] A contour plot question - vis.gam () function in "mgcv"

2012-04-03 Thread ilai
Try to plot the points first followed by vis.gam(...,type='contour', color='bw', add=T) instead of vis.gam followed by points. HTH On Tue, Apr 3, 2012 at 2:48 PM, Ravi Varadhan wrote: > Hi, > > Please see the attached contour plot (I am sorry about the big file).  This > was created using the

Re: [R] Filling empty List in a FOR LOOP

2012-04-01 Thread ilai
On Sun, Apr 1, 2012 at 9:59 AM, michaelyb wrote: > Basically I need to read the data from an external source using many R > commands. > The problem is that sometimes the source is empty, and I get a list with > empty values, and I need to substitute them by "NA". > It is def. not hard, I just don'

Re: [R] How to create arbitrary number of loops in R

2012-03-29 Thread ilai
On Thu, Mar 29, 2012 at 9:27 AM, ilai wrote: Oops, sent to fast. A (maybe) clearer solution: f <- function(x,m){ cmway <- combn(ncol(x),m) xx <- x[,cmway] dim(xx) <- c(nrow(x),nrow(cmway),ncol(cmway)) xx } f(M,3) str(sapply(2:4,f,x=M)) And again lapply / apply , or even return

Re: [R] How to create arbitrary number of loops in R

2012-03-29 Thread ilai
To cbind, you don't need a loop (M <- matrix(1:50,nc=10)) c2way <- combn(ncol(M),2) MM <- M[,c2way] dim(MM) <- c(nrow(M),nrow(c2way),ncol(c2way)) MM c3way <- combn(ncol(M),3) MMM <- M[,c3way] dim(MMM) <- c(nrow(M),nrow(c3way),ncol(c3way)) MMM etc. etc. Than you can (untested for icc) loop your

Re: [R] xyplot lattice fine control of axes limits and thick marks (with log scale)

2012-03-29 Thread ilai
On Thu, Mar 29, 2012 at 3:04 AM, maxbre wrote: > To answer your question: > - I did not put relation=’same’ because that is not what I want: i.e **for > each single panel** (in my case 4) I want to set the same limits for both x > and y axes (I want the diagonal line exactly bisect each panel);

Re: [R] resampling for correlation and testing

2012-03-28 Thread ilai
On Wed, Mar 28, 2012 at 8:03 PM, Benton, Paul wrote: > > On Mar 29, 2012, at 1:41 AM, ilai wrote: > >> On Wed, Mar 28, 2012 at 3:53 PM, Benton, Paul >> wrote: >>> Hello all R-er, >>> >>> ## Then test if rho.A[1,1] come from the distributi

Re: [R] resampling for correlation and testing

2012-03-28 Thread ilai
On Wed, Mar 28, 2012 at 3:53 PM, Benton, Paul wrote: > Hello all R-er, > > I'm trying to run a resampling method on some data. The current method I have > takes 2+ days or a lot of memory . I was wondering if anyone has a better > suggestion. > > Currently I take a matrix and get the correlation

Re: [R] matrix(unlist(strsplit(""))) 'missing value' issue

2012-03-28 Thread ilai
On Wed, Mar 28, 2012 at 6:49 AM, Petr PIKAL wrote: > What problem? Nabble is not available to all and here is not much to cook > from. Indeed. Also the OP actually provided their own solution, just 5 more minutes of googling to find ?sub. bankoffer.3 <- factor(c('999','429000:notaccepted','4

Re: [R] xyplot lattice fine control of axes limits and thick marks (with log scale)

2012-03-28 Thread ilai
On Wed, Mar 28, 2012 at 4:21 AM, maxbre wrote: > After a long and winding road (sorry but I'm a novice) I get to a final > result which is quite close to what I need; > nevertheless I would like to tweak a little further the xyplot Without dput(mydata) you are the only one who can do that... so

Re: [R] assigning vector or matrix sparsely (for use with mclapply)

2012-03-27 Thread ilai
It is (at least for me) really unclear what the problem is, or how it's related to mclapply. You say " this works fine, except that what I want to get NA's in the return positions that were not recalculated. then, I can write > > newdata$y <- ifelse ( is.na(olddata$y), mc.byselectrows( olddata,

Re: [R] Updating a Markov Chain

2012-03-26 Thread ilai
On Sun, Mar 25, 2012 at 3:50 PM, stivi wrote: > Hello, > > my question is if anyone has any good ideas how to create a Markov Chain > from ordered data. So, I have some sort of time series, and if value1 > happens as time1 and value2 happens at time2 I record this as an update to > the probability

Re: [R] Remove wireframe outer box but keep ticks

2012-03-23 Thread ilai
On Fri, Mar 23, 2012 at 2:07 PM, Bigelow, Seth W -FS wrote: > ilai/keren: > > Thanks for your response. It's not the 3d bounding box that I wish to > eliminate, but the box that surrounds the whole figure and is drawn > automatically (I call this the outer box, in contr

Re: [R] Remove wireframe outer box but keep ticks

2012-03-23 Thread ilai
See 'box.3d' in trellis.par.get() : wireframe(z ~ x*y, data = test, scales=list(arrows=F), par.settings = list(box.3d = list(col=NA))) Note you can have some finer control: wireframe(z ~ x*y, data = test, scales=list(arrows=F), par.settings = list(box.3d = list(col=c(1,2,NA,NA,3,NA,4,5,6))) )

Re: [R] Dotplot: how to change size in the y lab ?

2012-03-19 Thread ilai
On Mon, Mar 19, 2012 at 7:56 AM, Jose Bustos Melo wrote: > Hi everyone, > > I'm trying to reduce the font size in the Y  exe in this plot: > dotplot( bank ~ MV2007 + MV2009 , data = d, horiz = T,  par.settings = list(  superpose.symbol = list(  pch = 21,  fill = c( "lightblue", "lightgreen"),  ce

Re: [R] coloring wireframe plot with independent/separate matrix of color values.

2012-03-15 Thread ilai
On Wed, Mar 14, 2012 at 9:47 PM, Alex Miller wrote: > Dear R Users, > > I am trying to plot a matrix (a Digital Elevation Model) using wireframe > [lattice] and color that matrix based on a separate/independent matrix of > the same resolution This makes no sense. the values in DEM are the z-coord

Re: [R] Adding mean values to boxplots

2012-03-15 Thread ilai
You want to assign your call to boxplot as an object that contains the plot information set.seed(1) b <- matrix(rgamma(100,(1:4)/2,.5),nc=4) (bxp <- boxplot(b)) Now you can use the info in bxp for placement, e.g.: text(1:length(bxp$names),bxp$stats[3,],round(bxp$stats[3,],2),pos=3) By the way,

Re: [R] Needing a better solution to a lookup problem.

2012-03-14 Thread ilai
You could try doing it without a loop (.C or other): (rgnsnp <- merge(region,snps)) (rgnsnp[with(rgnsnp,STOP>=POS & POS >= START),]) Here is my test for merge+search on 100k/200k: fdf1 <- data.frame(chr=1:10,p=runif(10),d=sample(10)) fdf2 <- data.frame(chr=rep(1:10,2),s=runif(2

Re: [R] help with expression

2012-03-14 Thread ilai
On Wed, Mar 14, 2012 at 8:56 AM, Thomas Hoffmann wrote: > Hi all, > > I still fail to plot an axis title with the following expression: > > plot(0,xlab=expression('(SOC [' * kgm^{-2} * '])' * ^{-2})) > > the xlab should look like:   (SOC [kgm^2])^0.25 > > with an out bracket and a superscript. >

  1   2   >