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

2012-06-25 Thread Stephen Eglen
Deepayan Sarkar writes: > You can specify a fixed-width fontfamily if that helps: > > levelplot(matrix(seq(4,120,l=9),3,3), > colorkey = list(at = seq(0, 120, 20), > labels = list(labels = c(' 0',' 20',' 40',' > 60',' 80','100','120'), >

Re: [R] do.call or something instead of for

2012-06-25 Thread Rolf Turner
On 26/06/12 00:39, Kathie wrote: Dear R users, I'd like to compute X like below. X_{i,t} = 0.1*t + 2*X_{i,t-1} + W_{i,t} where W_{i,t} are from Uniform(0,2) and X_{i,0} = 1+5*W_{i,0} Of course, I can do this with "for" statement, but I don't think it's good idea because "i" and "t" are too

[R] weighted logistic regression

2012-06-25 Thread Katherine Nishimura
I have an epidemiologic dataset and want to do a weighted logistic regression. I have a continuous exposure variable and I want to see if it is associated with a binary outcome. The accuracy of the exposure value is highly variable and I want the logistic regression to assign greater weight/impor

Re: [R] Questions about doing analysis based on time

2012-06-25 Thread Rui Barradas
Hello, The following worked with the supplied dataset, named 'Sunday'. dat <- Sunday dat$SunDate <- as.POSIXct(Sunday$SunDate, format="%m/%d/%Y %H:%M") dat <- na.exclude(dat) h <- hours(dat$SunDate) # 1. Two different displays aggregate(dat$SunScore, by=list(h), mean) aggregate(SunScore ~ h, da

Re: [R] setdiff datframes

2012-06-25 Thread arun
Hi, Try this: example1<-data.frame(V1=c("rs4685","rs4685","rs788018","rs788023"),V2=c("2:198257795","2:198257795","2:198265526","2:198283305")) example2<-data.frame(V1=c("rs4685","rs4675","rs788018","rs788023"),V2=c("2:198257795","2:198258795","2:198265526","2:198283305")) subset(example2,!(V1 %in

[R] Fitting binomial data to a probit distribution without an equation

2012-06-25 Thread mort459
Hey everyone, I've been reading an old scientific paper (well, not that old, about 15 years) and I want to verify the authors' statistical results. The paper is fairly unclear about what exactly they did, and none of the relatively simple commands I'm familiar with are producing results similar to

[R] Passing Arima Parameters from Excel to R

2012-06-25 Thread PaulJr
Hello everyone, I would like to have an Excel SpreadSheet with a Macro that allows me to select between the following Models (in the form of a combobox): AR, MA, ARMA and ARIMA. And depending on the model chosen, give Excel the parameters (for p, q, d and P, D, Q). I want to find a way to connect

[R] rrdf package for mac not working

2012-06-25 Thread Ricardo Pietrobon
rrdf is incredibly helpful, but I've notice that the rrdf package for mac hasn't been working for some time: http://goo.gl/5Ukpn . wondering if there is still a plan to maintain that in the long run, or if there is some other alternative to read RDF files. [[alternative HTML version delete

Re: [R] combineLimits and Dates

2012-06-25 Thread Duncan Mackay
Hi Elliot This works on Win 7 ver 2.15 useOuterStrips(combineLimits( xyplot(x + y ~ d | g, groups = h, data = dat, type = 'l', scales = list(y = list(relation = "free"), x = list( at =seq(from = as.Date("2011-01-01"), to = as.Date("2011-10-01"), by = "3 month"),

Re: [R] read.spss function

2012-06-25 Thread peter dalgaard
On Jun 25, 2012, at 12:30 , Jim Holtman wrote: > you have to load the 'foriegn' package first. > 'foreign' works better > Sent from my iPad ...with spellcheck disabled, it seems ;-) -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Freder

Re: [R] graph displays

2012-06-25 Thread John Kane
xx <- structure(list(X1000s = c(47L, 37L, 17L), X600s = c(63L, 64L, 62L), X500s = c(75L, 45L, 25L), X250s = c(116L, 11L, 66L), X100s = c(125L, 25L, 12L), X50s = c(129L, 19L, 29L), X10s = c(131L, 61L, 91L), X5s = c(131L, 131L, 171L), X3s = c(131L, 186L, 186L), X1s = c(131L, 186L, 186L))

Re: [R] Conditioned Latin Hypercube Sampling within determined distance

2012-06-25 Thread SergioHGS
Hi, I'm sorry for not explaining well. I'm trying to do my best, but it's alittle complicated for me. I will send what I've tried but I think I should also provide some files to make possible for you to run the codes I'm running, but i couldn't find a way to do it. I have 2 rasters to represent en

Re: [R] Questions about doing analysis based on time

2012-06-25 Thread APOCooter
Oh, whoops. When I responded the first time, I had done dput(head(Sunday, 100)) too, but it didn't look useful. It was only just now that I saw that it basically prints out the vectors. Sorry about that. Anyways, here's dput(head(Sunday, 100)): > dput(head(Sunday, 100)) structure(list(SunDate

Re: [R] setdiff datframes

2012-06-25 Thread nac
thanks it works brilliantly wrote: > Hello, > > It is recomended to post data using dput(). Something like > > dput(head(DF, 20)) # or 30 > > Then, paste the output of this command in a post. > > Untested, but I think it should work: > > > # Create a logical index into 'example2' > ix <

[R] fitting a Bi-Weibull

2012-06-25 Thread Luis Borda de Agua
I want to fit a bi-Weibull distribution, as defined by Evans et al. in their book Statistical distributions: http://www.scribd.com/doc/57260630/164/FIVE-PARAMETER-BI-WEIBULL-DISTRIBUTION I would like to know if there is any package in R that already does it, or any quick procedure to accomplish

Re: [R] graph displays

2012-06-25 Thread Sarah Goslee
There's no way we can tell you the "best way" to display your information, because we don't know anything about it. The best display method has a lot to do with what the data are, and what you're trying to illustrate. That said, here are two possibilities, one using the bar graph you requested, and

[R] graph displays

2012-06-25 Thread MSousa
Good Afternoon, I'm trying to create a graph that displays the best way the following information.     For instance organized by bar graph, A, B, C Source X1000s X600s X500s X250s X100s X50s X10s X5s X3s X1s 1 A 476375 116 125 129 131 131 131 131 2 B 3764

Re: [R] Very simple question R5 setRefClass and Initialize

2012-06-25 Thread Martin Morgan
When I try your code I'm told that 'mongo' is not a defined class. Removing that field from the definition, I do not get a print on definition. > mongoDbUser = setRefClass("mongoDbUser", + fields = list( + auth = "logical", + host = "character", + username = "character", + pa

Re: [R] setdiff datframes

2012-06-25 Thread Rui Barradas
Hello, It is recomended to post data using dput(). Something like dput(head(DF, 20)) # or 30 Then, paste the output of this command in a post. Untested, but I think it should work: # Create a logical index into 'example2' ix <- example2$V1 %in% setdiff(example2$V1,example1$V1) example2[ix,

[R] setdiff datframes

2012-06-25 Thread nathalie
hi, I have 2 files example 1 and example 2 and would like to know what is in example2 and not in example1 (attached) V1 contain data which could be in duplicated which I am using as identifiers I used setdiff(example2$V1,example1$V1) to find the identifiers which are specific to example2: [

Re: [R] array complexity for the MH test

2012-06-25 Thread Richard M. Heiberger
I will try again. 1. If you have 5 groups, and split each in half, then you have 10 groups. If MH is applicable to 5 groups, then it should be applicable to the 10 groups as long as they are disjoint groups. 2. I don't think MH applies to your example because the groups do not have similar behavi

[R] combineLimits and Dates

2012-06-25 Thread Elliot Joel Bernstein
I'm having some trouble using the latticeExtra 'combineLimits' function with a Date x-variable: require(lattice) set.seed(12345) dates <- seq(as.Date("2011-01-01"), as.Date("2011-12-31"), "days") dat <- data.frame(d = rep(dates, 4), g = factor(rep(rep(c(1,2), each = length(date

Re: [R] using multiple cpu's - scaling in processing power

2012-06-25 Thread soren wilkening
Oh I was wrong. R package 'GridR' seems to be what one needs to run R scripts on Condor directly ... interesting. thanks again. - http://censix.com -- View this message in context: http://r.789695.n4.nabble.com/using-multiple-cpu-s-scaling-in-processing-power-tp4634405p4634442.html Sent from

[R] "Tight" Axes in Prepanel Function

2012-06-25 Thread Elliot Joel Bernstein
How do I specify a "tight" y-axis, where the plot completely fills the y-axis range, inside the prepanel function? For example, consider the following code: require(lattice) set.seed(12345) x <- 1:1000 y <- cumsum(rnorm(length(x))) prepanel.test <- function(x, y, groups = NULL, subscripts = NUL

Re: [R] using multiple cpu's - scaling in processing power

2012-06-25 Thread soren wilkening
Thanks Drew a first glance at Condor tells me that this will very likely do what I need in terms of flexible allocation of (cpu) resources. Unfortunately there is not much R integration so I will need to see if setting up Condor and submitting R jobs to it is worth the effort. Cheers Soren

[R] compare between mixdist models

2012-06-25 Thread Yakir Gagnon
Hi all! Is there any way to compare mixdist models with a different number of components using AIC or BIC? I'm looking for some similar functionality as in flexmix, but not sure which to stick with: mixdist or flexmix.. Yakir Gagnon cell+1 919 886 3877 office +1 919 684 7188 Johnsen Lab Biolog

Re: [R] mgcv: inclusion of random intercept in model - based on p-value of smooth or anova?

2012-06-25 Thread Simon Wood
Martin, I had a nagging feeling that there must be more to this than my previous reply suggested, and have been digging a bit further. Basically I would expect these p-values to not be great if you had nested random effects (such as main effects + their interaction), but your case looked rathe

Re: [R] Fractional Factorial - Wrong values using lm-function

2012-06-25 Thread Simon Knapp
and finally... thingy <- function(x) { x <- C(x, poly, 1) tmp <- contrasts(x) contrasts(x, 1) <- 2 * tmp / sum(abs(tmp)) x } dat2 <- with(data.catapult, data.frame( Distance, h=thingy(h), s=thingy(s), l=thingy(l), e=thingy(e), b=

Re: [R] Fractional Factorial - Wrong values using lm-function

2012-06-25 Thread Simon Knapp
... but this is tantalisingly close: dat1 <- with(data.catapult, data.frame( Distance, h=C(h, poly, 1), s=C(s, poly, 1), l=C(l, poly, 1), e=C(e, poly, 1), b=C(b, poly, 1) ) ) lm4 <- lm(Distance ~ .^2, data = dat1) summary(lm4) ... wish I kne

Re: [R] R-help Digest, Vol 112, Issue 25

2012-06-25 Thread John C Nash
While lm() is a linear modeling, the constraints make it easier to solve with a nonlinear tool. Both my packages Rvmmin and Rcgmin (I recommend the R-forge versions as more up-to-date) have bounds constraints and "masks" i.e., fixed parameters. I am actually looking for example problems of this

Re: [R] Fractional Factorial - Wrong values using lm-function

2012-06-25 Thread Simon Knapp
They are coding the variables as factors and using orthogonal polynomial contrasts. This: data.catapult <- data.frame(data.catapult$Distance, do.call(data.frame, lapply(data.catapult[-1], factor, ordered=T))) contrasts(data.catapult$h) <- contrasts(data.catapult$s) <- contrasts(data.catapult$l) <-

Re: [R] Fractional Factorial - Wrong values using lm-function

2012-06-25 Thread Bert Gunter
Staleno: As always, you need to read the Help file carefully. From ?aov: "The main difference from lm is in the way print, summary and so on handle the fit: this is expressed in the traditional language of the analysis of variance rather than that of linear models. " summary.aov() computes seque

Re: [R] do.call or something instead of for

2012-06-25 Thread Mark Leeds
thanks peter. I was thinking more about t but you're right in that there's an i there also. my bad ( twice ). On Mon, Jun 25, 2012 at 9:37 AM, Petr Savicky wrote: > On Mon, Jun 25, 2012 at 05:39:45AM -0700, Kathie wrote: > > Dear R users, > > > > I'd like to compute X like below. > > > > X_{i

Re: [R] do.call or something instead of for

2012-06-25 Thread Petr Savicky
On Mon, Jun 25, 2012 at 05:39:45AM -0700, Kathie wrote: > Dear R users, > > I'd like to compute X like below. > > X_{i,t} = 0.1*t + 2*X_{i,t-1} + W_{i,t} > > where W_{i,t} are from Uniform(0,2) and X_{i,0} = 1+5*W_{i,0} > > Of course, I can do this with "for" statement, but I don't think it's

Re: [R] Questions about doing analysis based on time

2012-06-25 Thread R. Michael Weylandt
On Fri, Jun 22, 2012 at 3:45 PM, APOCooter wrote: > > [snip and rearrange] > >> try to put your data in a proper time series class (zoo/xts if I >>might give a personal-ish plug) which will make all these calculations >>much easier. > > I thought that's what I was doing with as.POSIXlt? as.POSIXl

Re: [R] Questions about doing analysis based on time

2012-06-25 Thread John Kane
Arrgh yes I did mean dput(head(mydata, 100)). Thanks for catching it. John Kane Kingston ON Canada > -Original Message- > From: michael.weyla...@gmail.com > Sent: Fri, 22 Jun 2012 14:25:30 -0500 > To: jrkrid...@inbox.com > Subject: Re: [R] Questions about doing analysis based on time >

Re: [R] Possible bug in is.na.data.frame(): input without columns

2012-06-25 Thread Mikko Korpela
On 06/20/2012 05:36 PM, Mikko Korpela wrote: > Hello list! > > Let's construct a matrix / data.frame with 0 columns, but > 0 rows, and > non-NULL rownames. Then, call is.na() on both the data.frame and the > matrix. We find that is.na.data.frame() gives an error. When row.names > are removed, is.n

Re: [R] do.call or something instead of for

2012-06-25 Thread Mark Leeds
Hi Kathryn: I'm sorry because I didn't read your question carefully enough. arima.sim won't help because you don't have a normal error term. I think you have to loop unless someone else knows of a way that I'm not aware of. good luck. On Mon, Jun 25, 2012 at 8:39 AM, Kathie wrote: > Dear R us

Re: [R] do.call or something instead of for

2012-06-25 Thread Mark Leeds
Hi: Use arima.sim because when you have recursive relationships like that, there's no way to not loop. If arima.sim doesn't allow for the trend piece (0.1*t ), then you can do that part seperately using cumsum(0.1*(1:t)) and then add it back in to what arima.sim gives you. I don't remember if arim

Re: [R] Fractional Factorial - Wrong values using lm-function

2012-06-25 Thread Ståle Nordås
Hello. Thank you for the help. However, I'm not sure your reply answers my question. Let me rephrase: I'm trying to reproduce the values in the second table in the example on http://www.itl.nist.gov/div898/handbook/pri/section4/pri472.htm. The table shows the summary of the linear model, which

Re: [R] Very simple question R5 setRefClass and Initialize

2012-06-25 Thread Julien Cochennec
Help anyone? Is this impossible? I tried to use the initFields method but it did not change anything. Le 25/06/2012 10:55, Julien Cochennec a écrit : Hi, New to this list, and glad I found R5 which si a great improvement to R for my work. Something seems odd anyway, when I do a setRefClass, th

[R] tune.svm (e1071) takes forever

2012-06-25 Thread aramhovsepyan
Hi, I am in the process of migrating my machine learning scripts from bash + libsvm to R and for the past weeks I have been battling a substantial problem when using the tune.svm function from the e1071 package. The tune.svm function that performs the grid-search for the best cost and gamma parame

[R] do.call or something instead of for

2012-06-25 Thread Kathie
Dear R users, I'd like to compute X like below. X_{i,t} = 0.1*t + 2*X_{i,t-1} + W_{i,t} where W_{i,t} are from Uniform(0,2) and X_{i,0} = 1+5*W_{i,0} Of course, I can do this with "for" statement, but I don't think it's good idea because "i" and "t" are too big. So, my question is that Is

Re: [R] using multiple cpu's - scaling in processing power

2012-06-25 Thread Drew Tyre
Hi Soren Have you looked into using the condor scheduler (http://research.cs.wisc.edu/condor/)? I'm not aware of it linking up with multicore or other parallel processing code inside R, but I've used it to run multiple R processes on a variable number of processors where N can both increase and de

[R] Arules - predict function issues - subscript out of bounds

2012-06-25 Thread ankur verma
Hi, I'm doing a Market Basket Analysis in which I have a list of transaction id's in column 2 and transactions(product names) in column 1. I read this into a transaction file using a txn<-read.transaction(file="data.csv",format='single', rm.duplicates=F, cols=c(1,2)) If I want to use the apriori

Re: [R] Apply() on columns

2012-06-25 Thread Rui Barradas
Hello, again. Sorry, I've used 'sum' when it should be 'mean'. Rui Barradas Em 25-06-2012 12:49, Rui Barradas escreveu: Hello, It's not that complicated. f <- function(index, dat, offset=5){ x <- data.frame(Emp=dat[, index], Hours=dat[, index + offset]) aggregate(Hours~Emp, data=

Re: [R] Apply() on columns

2012-06-25 Thread Rui Barradas
Hello, It's not that complicated. f <- function(index, dat, offset=5){ x <- data.frame(Emp=dat[, index], Hours=dat[, index + offset]) aggregate(Hours~Emp, data=x, sum) } sp <- read.table("supermarkt.txt") lapply(1:5, f, sp) Also, please provide context. (Quote the post you

Re: [R] Apply() on columns

2012-06-25 Thread Petr PIKAL
> > I do now know how to navigate through the table. > But my question is, what kind of graphical and numerical summaries can I > make with keeping in mind that I am interested in the average working hour > per employee? Rather vague question without data or code, so rather vague answer. For nu

Re: [R] special simbol (±) in a legend

2012-06-25 Thread Prof Brian Ripley
The posting guide asked for 'at a minimum' information, which you have not provided (nor do we know what graphics device this is). But on many OSes and devices simply use the Unicode character "\u00b1". Or use plotmath (see ?plotmath). On 25/06/2012 12:03, gianni lavaredo wrote: dear resera

Re: [R] Apply() on columns

2012-06-25 Thread faelsendoorn
I do now know how to navigate through the table. But my question is, what kind of graphical and numerical summaries can I make with keeping in mind that I am interested in the average working hour per employee? -- View this message in context: http://r.789695.n4.nabble.com/Apply-on-columns-tp4633

[R] special simbol (±) in a legend

2012-06-25 Thread gianni lavaredo
dear reserachers, I am looking for a expression about a special symbol (±) in a Legend and add on front of "Mean ± SD" the symbol of bracket sorry if the example is not great disptest <- matrix(rnorm(10),nrow=10) disptest.means<- rowMeans(disptest) plot(1:10,disptest.means) dispersion(1:10,disp

Re: [R] read.spss function

2012-06-25 Thread Jim Holtman
you have to load the 'foriegn' package first. Sent from my iPad On Jun 25, 2012, at 5:12, niloo javan wrote: > Hi dear all, > I am trying to import a dataset from SPSS into R (R x64 2.15.0). > I used both > read.spss("D:/Untitled2.sav", use.value.labels = TRUE, to.data.frame = TRUE, > max.va

[R] using multiple cpu's - scaling in processing power

2012-06-25 Thread soren wilkening
Hi All In the past I have worked with parallel processing in R where a function F is applied to the elements of a list L. The more cpu cores one has, the faster the process will run. At the time of launching the process for (F,L) I will have a certain fixed number of cpu's that I can use. I have t

[R] read.spss function

2012-06-25 Thread niloo javan
Hi dear all, I am trying to import a dataset from SPSS into R (R x64 2.15.0). I used both   read.spss("D:/Untitled2.sav", use.value.labels = TRUE, to.data.frame = TRUE, max.value.labels = Inf, trim.factor.names = FALSE,trim_values = TRUE, reencode = NA, use.missings = to.data.frame) & read.spss("D

[R] Fractional Factorial - Wrong values using lm-function

2012-06-25 Thread Staleno
Hello. I'm a new user of R, and I have a question regarding the use of aov and lm-functions. I'm doing a fractional factorial experiment at our production site, and I need to familiarize myself with the analysis before I conduct the experiment. I've been working my way through the examples provide

[R] Very simple question R5 setRefClass and Initialize

2012-06-25 Thread Julien Cochennec
Hi, New to this list, and glad I found R5 which si a great improvement to R for my work. Something seems odd anyway, when I do a setRefClass, the initialize method execute at the class definition. I would like it to execute only when an instance is created. How can I do that? I found no way to

Re: [R] cannot use simple=TRUE in boot

2012-06-25 Thread he chen
Dear Rui, Thanks. I check the spell in the code, no wrong (just spell wrong in the error message). After I download the newest 2.15 version, the code work fine with me, too. I guess it resulted from the old version (2.7.1) I used. 2012/6/25 Rui Barradas : > Hello, > > Your code works with me

Re: [R] Replacing text with a carriage return

2012-06-25 Thread Rui Barradas
Hello, Instead of replacing "record_start" with newlines, you can split the string by it. And use 'gsub' to make it prettier. x <- readLines("test.txt") x y <- gsub("\"", "", x) # remove the double quotes y <- unlist(strsplit(y, "record_start,")) # do the split, with comma # remove leading

Re: [R] Boxplot with Log10 and base-exponent axis

2012-06-25 Thread Luigi
Dear Mr Dunlap, Your solution works really fine. Thank you for your time, Best wishes, Luigi -Original Message- From: William Dunlap [mailto:wdun...@tibco.com] Sent: 23 June 2012 18:48 To: Luigi Cc: 'Martin Maechler'; r-help@r-project.org Subject: RE: [R] Boxplot with Log10 and base-expo

Re: [R] Indexing matrices from the Matrix package with [i, j] seems to be very slow. Are there "faster alternatives"?

2012-06-25 Thread Duncan Murdoch
On 12-06-24 4:50 PM, Søren Højsgaard wrote: Dear all, Indexing matrices from the Matrix package with [i,j] seems to be very slow. For example: library(rbenchmark) library(Matrix) mm<- matrix(c(1,0,0,0,0,0,0,0), nr=20, nc=20) MM<- as(mm, "Matrix") lookup<- function(mat){ for (i in

[R] Replacing text with a carriage return

2012-06-25 Thread Thomas
I have a comma separated data file with no carriage returns and what I'd like to do is 1. read the data as a block text 2. search for the string that starts each record "record_start", and replace this with a carriage return. Replace will do, or just add a carriage return before it. The str

Re: [R] axis in r plot

2012-06-25 Thread Petr PIKAL
Hi > > I have the graph plotted with x axis(-50 to 250) and y axis (-50 to 500).I > need the x axis values(-50 to 250) with spacing between two tick marks as > 1or 0.1.The graph should be wider to get enough resolution. For the first case you shall have some special display as you will need a

Re: [R] significance level (p) for t-value in package zelig

2012-06-25 Thread Prof Brian Ripley
On 25/06/2012 09:32, Rune Haubo wrote: According to standard likelihood theory these are actually not t-values, but z-values, i.e., they asymptotically follow a standard normal distribution under the null hypothesis. This means that you Whose 'standard'? It is conventional to call a value of t

Re: [R] cannot use simple=TRUE in boot

2012-06-25 Thread Rui Barradas
Hello, Your code works with me, unchanged: > boot<-boot(c,table,100, sim="ordinary", stype="i",simple=TRUE) > boot ORDINARY NONPARAMETRIC BOOTSTRAP Call: boot(data = c, statistic = table, R = 100, sim = "ordinary", stype = "i", simple = TRUE) Bootstrap Statistics : original bias

Re: [R] significance level (p) for t-value in package zelig

2012-06-25 Thread Rune Haubo
According to standard likelihood theory these are actually not t-values, but z-values, i.e., they asymptotically follow a standard normal distribution under the null hypothesis. This means that you could use pnorm instead of pt to get the p-values, but an easier solution is probably to use the clm-

Re: [R] axis in r plot

2012-06-25 Thread sathya7priya
I have the graph plotted with x axis(-50 to 250) and y axis (-50 to 500).I need the x axis values(-50 to 250) with spacing between two tick marks as 1or 0.1.The graph should be wider to get enough resolution. -- View this message in context: http://r.789695.n4.nabble.com/axis-in-r-plot-tp4634199

[R] cannot use simple=TRUE in boot

2012-06-25 Thread he chen
I am doing boot with a large database, thus want to use simple=TRUE to reduce the memory used. I alreday set up sim="ordinary", stype="i" , but I don't know how to set "n=0". In fact, I don't know what does "n=0" mean? For example, a<-c(1:1000) b<-c(2:1001) c<-cbind(a,b) library(boot) table<-func

Re: [R] Loop for multiple plots in figure

2012-06-25 Thread baptiste auguie
Hi, Here's one approach: plot_one <- function(d){ with(d, plot(Xvar, Yvar, t="n")) # set limits with(d[d$param1 == 0,], lines(Xvar, Yvar, lty=1)) # first line with(d[d$param1 == 1,], lines(Xvar, Yvar, lty=2)) # second line } par(mfrow=c(2,2)) plyr::d_ply(data, "Subject", plot_one) HTH,

Re: [R] equality of values

2012-06-25 Thread Rui Barradas
Hello, Just as a complement, if you want to see a solution, and why. x <- 3/5 y <- 2/5 z <- 1/5 # x - (y + z) # not zero x == y + z all.equal(x, y + z) # x - y - z # not zero x - y == z all.equal(x - y, z) # To see why it works: abs diff less than tolerance equal <- function(x, y, tol=.Machi