Re: [R] lean text label below barplot table

2009-09-13 Thread Ilai
par(xpd=T) bp<- barplot(matrix(1:50,5,10),names=F) text(bp,-2,c('these labels','are tooo','looong'),pos=2,srt=45) Xiaogang Yang wrote: > > Hi, everyone: > I am plotting an graph with bar plot, but the label after every bar is too > long, I wanna if I can draw the label lean to an angle > t

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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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-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] 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] 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] 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] 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] 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-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] 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] 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] 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] 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] [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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] How to colorize the panel backgrounds of pairs()?

2012-03-01 Thread ilai
par('bg') is not what you are looking for - it will set the bg of the whole graphic device, not panels. I think you want: count <- 0 mypanel <- function(x, y, ...){ count <<- count+1 ll<- par('usr') if(count %in% c(1,4,9,12)) bg<- "#FDFF65" else bg<- 'transparent' rect(ll[1],ll[3],ll

Re: [R] Parameterization of Inverse Wishart distribution available in MCMCpack and bayesm libraries

2012-03-01 Thread ilai
What do you make of the following from ?riwish " riwish(v, S) v: Degrees of freedom (scalar). " does a m/2 parameterization yield a scalar for, say, 3 dof ? On Thu, Mar 1, 2012 at 9:55 AM, Shantanu MULLICK wrote: > Hello Everyone > > Both the MCMCpack and the bayesm libraries allow u

Re: [R] Parameterization of Inverse Wishart distribution available in MCMCpack and bayesm libraries

2012-03-02 Thread ilai
On Fri, Mar 2, 2012 at 1:22 AM, peter dalgaard wrote: > > Er, yes (scalar does not imply integer) Dough! awkward... Sorry Shantanu. I've added cat('###\n # ',substr(fortunes::fortune(90)$quote,1,146),'\n ### \n') To .First in my Rhelp directory. Hope that helps (me). > > As a general ma

Re: [R] Computing line= for mtext

2012-03-02 Thread ilai
On Fri, Mar 2, 2012 at 1:17 PM, Frank Harrell wrote: > Hi Rich and Peter, > > What I am trying to do is the right-justify a vector of numbers to the right > of the y-axis so that the leftmost digit of all of the numbers is one > character to the right of the axis line.  axis() plots tick marks and

Re: [R] Grouped barchart confidence intervals in lattice

2012-03-03 Thread ilai
On Sat, Mar 3, 2012 at 5:48 PM, Nathan Lemoine wrote: > It appears that the subscripts are only passing two values, the center of > each group. There should be six values, one for the center of each bar > (correct?), No. That's also why your code doesn't work. x[subscripts] are not the centroi

Re: [R] Grouped barchart confidence intervals in lattice

2012-03-04 Thread ilai
(i.e. a bar with a width of 1in a group of three bars has a half width > of 1/6) > groupS - (nv+1)/2 gives each bar's relative position to the central bar > > Am I interpreting these correctly? One thing I don't get is where 3/4 came > from. > > Anyway, thanks for

Re: [R] GLMing with all possible combinations (automatically)

2012-03-07 Thread ilai
Hi try glm(Response~ .^2, data=yourdata.frame) For all predictors (.) and 2-way interactions (^2). You might also want to see ?drop.terms and ?formula for automating the construction of all model combinations. Side note: R is not SAS (fortunately). Interaction is denoted ":", X*Y is shorthand for

Re: [R] confidence intervals in dotplots in a for loop

2012-03-07 Thread ilai
On Tue, Mar 6, 2012 at 8:55 PM, Byerly, Mike M (DFG) wrote: > > estimates <- c(67.42,30.49,32.95,23.53,10.26,6.03,23.53,0.93,50.72,24.2,25.84,18.54, 7.16,3.6,9.35,0.33,87.28,37.25,40.16,28.59,13.77,8.92,40.74,1.68,48.28,23.09, 24.49,17.7,6.63,3.28,7.79,0.26,91.63,38.74,41.6,29.74,14.49,9.51,44.1

Re: [R] How to eliminate for next loops in this script

2012-03-07 Thread ilai
?by ?aggregate On Tue, Mar 6, 2012 at 4:14 PM, Walter Anderson wrote: > I needed to compute a complicated cross tabulation to show weighted means > and standard deviations and the only method I could get that worked uses a > series of nested for next loops.  I know that there must be a better wa

Re: [R] layer plots.

2012-03-09 Thread ilai
It's hard to help if you keep changing the framework of your problem, first two matrices - now it's a data.frame and a list of subset row names in a plotting method from whatever package "suprow" comes from. Regardless, Michael's original answer already gave you a solution: plot(table1,type='l',lw

Re: [R] Use different panel functions with lattice

2012-03-10 Thread ilai
On Sat, Mar 10, 2012 at 9:33 AM, Balaitous wrote: > Hi, > > I have a data.frame df with > names(df) = c("Var1", "Var2", "Var3", "Var4") > > and I plot data with > > xyplot(Var1+Var2~Var3|Var4, data=df) > > I want to use different panel functions for Var1 and Var2. > How can I do ? You didn't spec

Re: [R] Use different panel functions with lattice

2012-03-10 Thread ilai
Inline On Sat, Mar 10, 2012 at 1:47 PM, Balaitous wrote: > Le samedi 10 mars 2012 à 12:25 -0700, ilai a écrit : >> On Sat, Mar 10, 2012 at 9:33 AM, Balaitous wrote: > > Var1 and Var2 are 2 two different observed variables (with different scales) You might want to consider sca

Re: [R] barplot and NA

2012-03-12 Thread ilai
d2 <- as.matrix(c(2,NA,4)) barplot(d2,beside=T) barplot(c(d2)) barplot(na.omit(d2)) d2[2,] <- 0 barplot(d2) # So barplot is not "stopping" at the first NA (first 2 plots). But what does stacking even mean when you have a missing group in the middle ? you can't expect barplot to know... if yo

Re: [R] 3D Black-Scholes Graph Help!

2012-03-13 Thread ilai
On Tue, Mar 13, 2012 at 3:34 PM, David Winsemius wrote: > > When I got around to running it I was hampered by a lack of knowledge about > what sort of data-object "price" might have been. I tried putting in a > single number on hte theory that it would saitisfy the seq() call, and also >  got the

Re: [R] Visualising multiple response contingency tables

2012-03-13 Thread ilai
Not sure I understand your question (or if there is one) and I am not familiar with vcd::mosaic. But if you are asking is there a simpler way ? than yes: 1. work with ?array and ?aperm 2. create the array directly in R from the original data - not excel 3. ?mosaicplot (no package required - it's in

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. >

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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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-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-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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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: >

[R] Lattice: correct use of ltransform3dto3d to plot a surface under a cloud ?

2012-02-04 Thread ilai
Hello list! I am trying to project the fitted surface to a 3d plot of the data, similar to figures 13.7 or 6.5 in Deepayan Sarkar's "Lattice, Multivariate Data Visualization with R", but replace the contour/map lines with "levelplot". Problem is I can't get the color regions to line up after the co

Re: [R] how do I exort a list of numbers into csv file?

2012-02-05 Thread ilai
cat will wrap Josh's "overkill" approach in one line: mylist<- list(1:3,3:9) lapply(mylist , cat , sep=',' , fill=T , append=T , file='foo.csv') Cheers On Sun, Feb 5, 2012 at 7:42 PM, Joshua Wiley wrote: > Hi Michael, > > Part of me imagines this is overkill, but this should be one option: > >

Re: [R] Multi-page PDF using dev.copy2pdf(filename, onefile=TRUE)?

2012-02-06 Thread ilai
Doug, dev.copy2pdf closes the connection after it's "done", so onefile is meaningless. To look at each plot before copy to a single pdf, you could open a pdf(...) but revert between it and your graphic device: graphics.off() plot(1:7, 1:7) x11c<- dev.cur() # your current graphics device pdf(f

  1   2   >