Re: [R] lattice log scale labels.

2024-09-05 Thread Gerrit Draisma
and "labels" components of the "scales" list argument to xyplot not do what you want? Cheers, Bert On Thu, Sep 5, 2024 at 4:05 AM Gerrit Draisma <mailto:gdrai...@xs4all.nl>> wrote: Dear R-helpers, In the plot below I would like to have labels at pos

[R] lattice log scale labels.

2024-09-05 Thread Gerrit Draisma
Dear R-helpers, In the plot below I would like to have labels at positions 2^(3*(0:10)), and keep the labels in the exponential format. I tried using yscale.components.default. *This* gives the right format of the labels: > yscale.components.default(lim= c(0,30),log=2) $num.limit [

Re: [R] Need help using lattice

2021-02-09 Thread Gerrit Draisma
=factor(3:12, levels=1:12,        labels=AprToDec, ordered=TRUE)) I get + signs in front of monames and labels, again as expected, but then it gives me another + sign. And if I try to add another ), it keeps giving me + signs. What is happening here? From: Gerrit Draisma Date: Tuesday, Febr

Re: [R] Need help using lattice

2021-02-09 Thread Gerrit Draisma
Ha David, Thanks for your reply. For your last question, you have to change month into an ordered factor variable: library(lattice) df <- expand.grid(site=c("een","twee","drie","vier","vijf"), month=factor(3:12,levels=1:12, labels=month.abb, ordere

[R] Need help using lattice

2021-02-08 Thread Gerrit Draisma
David, Is this what you are looking for? library(lattice) df <- expand.grid(site=c("een","twee","drie","vier","vijf"), month=1:12) df$conc <- rnorm(dim(df)[1]) dotplot(month~conc|site,data=df) HTH Gerrit __ R-help@r-project.org mailing

[R] turning a list of objects into columns

2019-06-30 Thread Gerrit Draisma
Ha Janet, Does this reshape do what you want: df = read.table(header=TRUE,text=" scen streamflowtrans evap psn 1 0.019234 1.658967 0.002883 0.002391 1 0.019027 1.661192 0.002844 0.003142 2 0.018821 1.695623 0.003192 0.002167 2 0.018619 1.503481 0.002536 0.003059 3 0.018425

Re: [R] Problem with Example with Lattice

2017-05-28 Thread Gerrit Draisma
Hallo Lorenzo, In addition to Berts advice try > trellis.par.get("superpose.symbol") which shows the default for superposed graphics and set them with the par.settings parameter > dotplot(VADeaths, type = "o", + auto.key = list(lines = TRUE, space = "right"), + main = "Death Rates in Virginia - 19

Re: [R] Multiple Histograms in R

2017-04-21 Thread Gerrit Draisma
Prateek, Does lattice do what you want? HTH Gerrit ppdat<-read.table(text="mou_mean,totalmrc_mean,rev_range,mou_range,Churn 23,24,25,27,1 45,46,47,49,1 43,44,45,47,1 45,46,47,49,0 56,57,58,60,0 67,68,69,71,1 67,68,69,71,0 44,45,46,48,1 33,34,35,37,0 90,91,92,94,1 87,88,89,91,1 76,77,78,80,1 33,34

Re: [R] Scaling x axis

2016-02-26 Thread Gerrit Draisma
Ha Fabio, With lattice' xyplot you can do - library(lattice) x<-as.Date(rnorm(10)*10,origin="2016-1-1") y<-5+rnorm(10) xyplot(y~x,type="h",scales=list(x=list(at=x,rot=90))) - And yes, labels may overlap, even with rotation. Gerrit. Message: 5 Date: Thu, 25 Feb 2016 12:31:00 + From:

Re: [R] attribute and main value

2014-12-29 Thread Gerrit Draisma
tor. Bill Dunlap TIBCO Software wdunlap tibco.com <http://tibco.com> On Mon, Dec 29, 2014 at 8:17 AM, Gerrit Draisma mailto:gdrai...@xs4all.nl>> wrote: Thanks Duncan. But my question was how to extract simply the function value from value, without the gradient attribute

Re: [R] attribute and main value

2014-12-29 Thread Gerrit Draisma
ot;gradient") [1] 2 > value[1] [1] 1 -- Is that the way? Gerrit On 12/29/2014 05:05 PM, Duncan Murdoch wrote: On 29/12/2014 10:32 AM, Gerrit Draisma wrote: Just a curiosity question: In the documentation for the nlm procedure a find this example of defining a function with a

[R] attribute and main value

2014-12-29 Thread Gerrit Draisma
Just a curiosity question: In the documentation for the nlm procedure a find this example of defining a function with a gradient attribute: --- f <- function(x, a) { res <- sum((x-a)^2) attr(res, "gradient") <- 2*(x-a) res } --- I get the

Re: [R] lattice question: removing strips

2014-02-11 Thread Gerrit Draisma
Dear Martin, Would - library(latticeExtra) useOuterStrips(p) - be useful for you? Gerrit. -- Message: 1 Date: Mon, 10 Feb 2014 14:12:45 +0200 (EET) From: Martin Ivanov To: Pascal Oettli Cc: r-help@r-pr

Re: [R] eliminating white space in lattice plot

2014-01-20 Thread Gerrit Draisma
Thanks Duncan, I will have a look at the print command. Gerrit. op 1/18/2014 2:23 PM Duncan Mackay schreef: I forgot to mention for multiple plots ? print.trellis Duncan -Original Message- From: Gerrit Draisma [mailto:gdrai...@xs4all.nl] Sent: Saturday, 18 January 2014 21:49 To: arun

[R] eliminating white space in lattice plot

2014-01-17 Thread Gerrit Draisma
the plot has a lot of white space above and below the graph. That makes it more difficult to include in a LaTeX document. Thanks, Gerrit Draisma = library(lattice) X<-data.frame(x=1:100,y=runif(100)) # pdf("wideplot.pdf") xyplot(y~x,data=X,type="l"

Re: [R] Lattice: how to change the canvas size with Sweave

2013-11-17 Thread Gerrit Draisma
Draisma schreef: Dear all, I would like to include a wide graph with narrow height in my LaTeX output. Up to now I only get it done using Stangle and including pdf("pietje-001.pdf",width=7,height=4) xyplot(...) dev.off() What is the correct way of setting the canvas size? Thanks. Gerr

[R] Lattice: how to change the canvas size with Sweave

2013-11-17 Thread Gerrit Draisma
Dear all, I would like to include a wide graph with narrow height in my LaTeX output. Up to now I only get it done using Stangle and including pdf("pietje-001.pdf",width=7,height=4) xyplot(...) dev.off() What is the correct way of setting the canvas size? Thanks. Gerr

Re: [R] how to combine apply and which or alternative ways to, do so

2013-08-25 Thread Gerrit Draisma
Ha Guillaume, Is this what you are looking for? #--- x1<-sample(1:10,5,replace=FALSE) x2<-sample(1:10,100,replace=TRUE) #This tapply(x1,1:5,FUN=function(i){which(x2==i)}) #or this tapply(x1,x1,FUN=function(i){which(x2==i)}) #--- Gerrit ___

Re: [R] integrate / Vectorize question

2012-10-04 Thread Gerrit Draisma
-10-2012 21:59, Gerrit Draisma escreveu: Dear R-users, I want to use the function Fnum below in another integrate procedure. How do I write Fnum so that it returns a vector of values? And will the last integrate return the right answer? (I tried Vectorize() in several places, but got all sorts

[R] integrate / Vectorize question

2012-10-03 Thread Gerrit Draisma
Dear R-users, I want to use the function Fnum below in another integrate procedure. How do I write Fnum so that it returns a vector of values? And will the last integrate return the right answer? (I tried Vectorize() in several places, but got all sorts of errors.) Thanks for helping out. Ger

Re: [R] how to include integrate in a function that can be solved with uniroot?

2011-11-15 Thread Gerrit Draisma
,th) x*g(x, th), 0, Inf, th)$value } Also, it's value, not Value, which might be producing errors of another sort. Michael On Mon, Nov 14, 2011 at 9:16 AM, Gerrit Draisma wrote: Thanks Michael, I see now how to include integrate function in the EV function. And apologies: I now realize

[R] how to include integrate in a function that can be solved with uniroot?

2011-11-14 Thread Gerrit Draisma
Hallo, I am trying to define expectation as an integral and use uniroot to find the distribution parameter for a given expectation. However I fail to understand how to define properly the functions involved and pass the parameters correctly. Can anyone help me out? Thanks, Gerrit Draisma

Re: [R] understanding output of tapply/by cumsum

2010-12-08 Thread Gerrit Draisma
2 2 22.2 43.4 23 3 2 2 32.2 63.4 24 4 2 2 42.2 83.4 25 5 2 2 52.2 103.4 26 1 3 2 13.2 36.6 27 2 3 2 23.2 66.6 28 3 3 2 33.2 96.6 29 4 3 2 43.2 126.6 30 5 3 2 53.2 156.6 On Tue, Dec 7, 2010 at 6:39 AM, Gerrit Draisma wrote: Dear R-users, I have a dataset with categories and numbers. I wo

[R] understanding output of tapply/by cumsum

2010-12-07 Thread Gerrit Draisma
uot;2" - attr(*, "call")= language by.default(data = d$n, INDICES = list(d$a, d$c), FUN = cumsum) - attr(*, "class")= chr "by - # these give (a) lists of one numerical vector(a) Sn[5,2] Sn[cbind(d$a,d$c)] # how to access the individual cumsum values? # and

[R] combined plot of observed and expected fractions

2010-11-30 Thread Gerrit Draisma
quot;, par.settings=list(superpose.line=list(col=c("blue","red"),lty=1:2), superpose.symbol=list(col=c("blue","red"),type=1)), auto.key=list(text=c("Obs","Pred"), points=F,lines=T,type="o",divide=1,columns=2) ) =

[R] printing a dataframe by categories

2010-05-19 Thread Gerrit Draisma
I am looking for the following simple question. I have a data frame with names and numbers, divided in categories. I would like to produce a text file with page breaks, listing the names and numbers by category, and totalling the numbers. Example: Name<-LETTERS[1:6] Score<-rep(5:8,length.out

Re: [R] latex.table for table with character and numeric columns

2009-12-07 Thread Gerrit Draisma
Ha Charlie, It helped. It is just what i was looking for. Gerrit. Gerrit Draisma wrote: Hallo, I have a dataset with one or two columns with character data and the rest with numeric data. Using latex.table from the quantreg package produced a table, but I cannot set the decimals. For instance

[R] latex.table for table with character and numeric columns

2009-12-04 Thread Gerrit Draisma
Hallo, I have a dataset with one or two columns with character data and the rest with numeric data. Using latex.table from the quantreg package produced a table, but I cannot set the decimals. For instance: --- > x<-data.frame(Name=c("Jan","Piet","Jan"), V=c(1,2.991,3)) > latex.table(as.matrix(x),

[R] correct line types in lattice legends

2009-06-06 Thread Gerrit Draisma
Hallo R-users, I do not understand how to specify the correct line and symbol types in the legends of a lattice xyplot. This is what I tried, but the line types and symbol in the graph are not seen in the legend. Any help is appreciated. Thanks, Gerrit. library(lattice) s<-rep(1:3,len=10) x<- 1

[R] Vectorize tapply(...,cumsum) output

2008-04-09 Thread Gerrit Draisma
I would like to graph cumulative counts and use tapply(...,cumsum) to get the cumulative counts. For instance: library(lattice) t<-rep(1:4,each=3)#time i<-rep(1:3,times=4) #categories n<-rpois(length(t),t) #count xyplot(n ~ t,groups=i, type="o",key=simpleKey(as.charact