Re: [R] Matching pairs of values

2010-03-27 Thread Peter Ehlers
sort before testing: vtest <- function(x, lookfor){ any(apply(x, 1, function(v) {identical(sort(v), sort(lookfor))}))} -Peter Ehlers On 2010-03-27 2:46, Berend Hasselman wrote: David Scott-6 wrote: I am sure someone can come up with a clever way of do

Re: [R] Matching pairs of values

2010-03-27 Thread Peter Ehlers
7 [3,]13 vtest(ma,c(3,7)) [1] TRUE vtest(ma,c(1,7)) [1] FALSE Berend -- Peter Ehlers University of Calgary __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-pro

Re: [R] data frame select max group by like function

2010-03-09 Thread Peter Ehlers
I find ddply() in package plyr handy for this sort of thing: library(plyr) f <- function(x) x[which.max( x[["score"]] ), ] ## x will be a subset of Dat according to ID ddply(Dat, "ID", f) -Peter Ehlers On 2010-03-09 11:59, Ista Zahn wrote: Hi Richard, There a

Re: [R] sorting data whilst ignoring NA's

2010-03-09 Thread Peter Ehlers
ing something? Or do you just want: qdata[order(qdata$flow, decreasing=TRUE), ] -Peter Ehlers But this sorts the data by flow value and then year I think giving: day month year flow [1,] 14 3 1947 222.40 [2,] 15 3 1947 NA [3,] 18 3 1947 NA [4,] 17 3 1

Re: [R] Help with adding points to allEffects plot

2010-03-09 Thread Peter Ehlers
As you can see on ?effects help page, plot.eff() uses lattice graphics. You can't mix those with traditional graphics commands. This should work: plot(allEffects(GSMOD), ask=FALSE) trellis.focus("panel", 1, 1) panel.points(y, x) trellis.unfocus() -Peter Ehlers On 2010-03

Re: [R] how can I look at .Internal(model.matrix(t, data))?

2010-03-09 Thread Peter Ehlers
I imagine it's in https://svn.r-project.org/R/trunk/src/main/model.c -Peter Ehlers On 2010-03-05 12:43, Werner W. wrote: Hi, I would like to see how model.matrix expands factor column to a set of dummy columns. I think that is done int .Internal(model.matrix(t, data)) which is c

Re: [R] ctree - party package multivariate response variables

2010-03-08 Thread Peter Ehlers
Your description of your data isn't clear to me. What are the values in column 2, for example? Are you trying to construct regression or classification trees? A reproducible example would really help. -Peter Ehlers On 2010-03-08 20:40, valeriano.parravic...@unige.it wrote: Hi, I h

Re: [R] Help with Hmisc, cut2, split and quantile

2010-03-08 Thread Peter Ehlers
) read_data$DEC<- with(read_data, cut(Target, breaks=brks, labels=1:10)) But I still don't see why you want a list of separate data frames. For most analyses, it's more convenient to just use the factor variable to subset the data as needed. -Peter Ehlers Thank

Re: [R] A slight trap in read.table/read.csv.

2010-03-08 Thread Peter Ehlers
Ditching T/F for TRUE/FALSE would get my vote, too. -Peter Ehlers On 2010-03-08 17:44, Rolf Turner wrote: On 9/03/2010, at 11:17 AM, Mike Prager wrote: Rolf Turner wrote: I solved the problem by putting in a colClasses argument in my call to read.csv(). But I really think that the read

Re: [R] why this function does not run correctly?

2010-03-08 Thread Peter Ehlers
DNAME <- paste(names(mf), collapse = " by ") names(mf) <- NULL y <- do.call("anova.welch", c(as.list(mf), list(nu))) ## include 'nu' in the parameters passed to ##anova.welch.default y$data.name <- DNAME y } (

Re: [R] Help with Hmisc, cut2, split and quantile

2010-03-08 Thread Peter Ehlers
ta) next_decile = ...and so on... bottom_decile = ... I would just add a factor variable indicating to which decile a particular observation belongs: dat$DEC <- with(dat, cut(Target, breaks=10, labels=1:10)) If you really want to have separate data frames you can then split on the decile:

Re: [R] fit a gamma pdf using Residual Sum-of-Squares

2010-03-08 Thread Peter Ehlers
edict(fit, data.frame(x=xx)) plot(y ~ x) lines(yy ~ xx, col='red') -Peter Ehlers But I have the following message error (sorry, this is in German): Fehler in qr(.swts * attr(rhs, "gradient")) : Dimensionen [Produkt 3] passen nicht zur L�nge des Objektes [23] Zus�tzlich:

Re: [R] (box-) plot annotation: italic within paste?

2010-03-08 Thread Peter Ehlers
Here's a variation on the theme: boxplot(x[,i]) title(main = bquote(.(mainlabel1)~~italic(.(predictor[i]))~~.(mainlabel2)) ) -Peter Ehlers On 2010-03-08 8:46, Miguel Porto wrote: Hello, Try this way (not sure if it's the best way, but it works): boxplot(x[,i], main=

Re: [R] mlogit

2010-03-07 Thread Peter Ehlers
mldata, reflevel="1") use mlogit.model <- mlogit(brand~1|female+age, data = mydata, ## note: 'mydata', not 'mldata' reflevel = "1", varying = NULL, choice = "brand"

Re: [R] mlogit

2010-03-07 Thread Peter Ehlers
ly where the error has crept in. I tried also with R version 2.10.1 Patched (2010-01-05 r50896). Same result. So I suspect it's the version of mlogit. I should have cc'd Yves; doing so now. -Peter Ehlers On 2010-03-07 11:30, David Winsemius wrote: Looks like a problem that the main

Re: [R] mlogit

2010-03-07 Thread Peter Ehlers
mlogit() which appears to cause the problem. This works: mdata<-mlogit.data(mydata, varying=NULL, choice="brand", shape="wide") mlogit.model<- mlogit(brand~1|female+age, data = mdata, reflevel="1") -Peter Ehlers brand female age 1.1 TRUE 0 24 1

Re: [R] xyplot: strip size

2010-03-07 Thread Peter Ehlers
r.get() -Peter Ehlers Thanks for any tips. Hadassa [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htm

Re: [R] Plotting Comparisons with Missing Data

2010-03-06 Thread Peter Ehlers
(x) sum(!is.na(x # A B C D # 4 2 3 3 For (b), you could either use reshape() to transform to wide format or generate an appropriate matrix; in either case, follow with apply(): m <- with(data, tapply(result, list(instance, solver), function(x) x)) m apply(m[,-1], 2, function(x) sum(x &

Re: [R] Three most useful R package

2010-03-05 Thread Peter Ehlers
I don't know if this is too long for a fortune, but it sure seems to be that it should be one. Anyway, thanks for the chuckle, Greg. -Peter Ehlers On 2010-03-04 13:29, Greg Snow wrote: Well, the HeadSlap package would of course require the esp package so that it could tell the diffe

Re: [R] Binding a matrix to a matrix

2010-03-02 Thread Peter Ehlers
e found it that way. But libary(sos) ???"bind arrays" would find it as the first item. -Peter Ehlers cheers, Rolf Turner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] Bartlett Test

2010-03-01 Thread Peter Ehlers
hard. help.search('Bartlett') immediately leads you to bartlett.test. But why on earth would you want to do a Bartlett test? You would be well advised to read the reference quoted in ?fligner.test. -Peter Ehlers Thanks in advance

[R] Fwd: Re: Kohonen Package

2010-03-01 Thread Peter Ehlers
This was sent to me personally but was probably meant for R-help. Original Message Subject: Re: [R] Kohonen Package Date: Mon, 1 Mar 2010 14:45:13 +1000 From: Martin To: ehl...@ucalgary.ca Hi Any idea if the kohonen package can produce umatrices with hexagons and component p

Re: [R] A slight trap in read.table/read.csv.

2010-03-01 Thread Peter Ehlers
o such a change. I agree with Rolf. Indeed, I'm not fond of the use of T/F for TRUE/FALSE at all. cheers, Rolf Turner ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

Re: [R] scan and skip - without line breaks in the input file

2010-02-27 Thread Peter Ehlers
Talk about asleep at the switch. My sincere apologies to both Susanne and David for my stupid message and to group for wasting everyone's time. Ouch, that headslap hurt. -Peter On 2010-02-27 11:05, Peter Ehlers wrote: David, Susanne, There may be a misunderstanding here. As I understa

Re: [R] Help Computing Probit Marginal Effects

2010-02-27 Thread Peter Ehlers
ple? Or do you just want to plot the Normal curve with mean equal to b1 and SD equal to s1? -- Peter Ehlers University of Calgary __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http:/

Re: [R] scan and skip - without line breaks in the input file

2010-02-27 Thread Peter Ehlers
other than inserting delimiters before passing off to R. But Susanne, why do you need to read your data in this piece-meal fashion? -Peter Ehlers On 2010-02-27 10:46, David Winsemius wrote: On Feb 27, 2010, at 11:47 AM, Balzer Susanne wrote: Hei David, Thanks for your quick response

Re: [R] Newbie help with ANOVA and lm.

2010-02-27 Thread Peter Ehlers
or df=c(1,1,dfr). For models with an intercept the first component of df should always be 1. But this is discarded in the output matrix. With two numerical predictors: y ~ x1 + x2, you should find that asgn = c(0,1,2) leading to df = c(1,1,1,dfr). -Peter Ehlers Thank you. Kevin _

Re: [R] Error in mvpart example

2010-02-27 Thread Peter Ehlers
uot;, as.integer(n), as.double(x), rep(format,n), out= rep(dummy, n), NAOK=TRUE, PACKAGE="mvpart")$out if (is.matrix(x)) matrix(temp, nrow=nrow(x)) #else temp else matrix(te

Re: [R] Help Computing Probit Marginal Effects

2010-02-27 Thread Peter Ehlers
o/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Peter Ehlers University of Calgary __ R-help@r-project.org mailing list https://stat.ethz.ch/m

Re: [R] t-distribution values

2010-02-26 Thread Peter Ehlers
How about taking the unusual step of reading 'An Introduction to R', where, if you peruse the table of contents, you will quickly be led to Chapter 8: Probability Distributions. -Peter Ehlers On 2010-02-26 7:23, Антон Морковин wrote: Dear all, how to calculate v

Re: [R] variable substitution in for loops

2010-02-24 Thread Peter Ehlers
Jon Erik, I don't know where you get 'varslist', but if it's from a text file, then why not scan() it into a *vector* instead of using (I assume) read.table() to create a data.frame. You'll save yourself much grief. -Peter Ehlers On 2010-02-24 20:19, David Winsemius

Re: [R] mlogit is not an S4 object error

2010-02-24 Thread Peter Ehlers
is not an S4 object Looks like the wrong summary method is being used. Your sessionInfo() might help. -Peter Ehlers I'm running on Windows XP R 2.10.1 Does anyone have any ideas why this is failing ? Thanks Steve Steve Friedman Ph. D. Spatial Statistical Analyst Everglades and Dry Tortu

Re: [R] Circles around letters or numbers in plot title

2010-02-23 Thread Peter Ehlers
generated. Any tips or ideas beyond plotting a circle in the margin? Why not just use bold and a larger font size? -Peter Ehlers Benjamin Benjamin Nutter | Biostatistician | Quantitative Health Sciences Cleveland Clinic | 9500 Euclid Ave. | Cleveland, OH 44195 |

Re: [R] adding infrequent date labels to x-axis

2010-02-23 Thread Peter Ehlers
__ May Nov May Nov Aug Feb Aug Feb http://n4.nabble.com/file/n1566433/TimeSeries_Example1.jpg The plotrix package has staxlab(). -Peter Ehlers Respectfully, Eric -- Peter Ehlers University of Calgary __

Re: [R] Count between interval

2010-02-22 Thread Peter Ehlers
And as long as the interval is symmetric about zero: sum(abs(x) <= 2) [1] 6 -Peter Ehlers On 2010-02-22 9:18, Jorge Ivan Velez wrote: Hi, Here is a suggeston: x<- c(-1.3, 1, -1.5, -1, 1.5, -2.5, 3, -0.5) sum(x>=-2& x<=2) [1] 6 HTH, Jorge On Mon, Feb 22, 2010 at

Re: [R] Error with write.table

2010-02-21 Thread Peter Ehlers
wo dataframes. Try instead: a <- data.frame(a, b) ## no problem (assuming same number of rows) or a[, "b"] <- b ## R tells you that you're trying to do something you shouldn't. -Peter Ehlers __ R-help@r-pr

Re: [R] Newbie woes with par:mar

2010-02-21 Thread Peter Ehlers
x27;t work). -Peter Ehlers trying various values for the second vector element, but do not notice any change. Consulting this nice tutorial http://research.stowers-institute.org/efg/R/Graphics/Basics/mar-oma/index.htm has not helped. Can anyone point me in the right direction? Thank you. -- Pe

Re: [R] How get the single bar x coordinate in barchart when groups is used?

2010-02-21 Thread Peter Ehlers
t on the x-scale; Now we need to know the relationship of 's' to 'd': 3*d/s = 2; Hence 3*d + 3*d/2 = 1 => d = 2/9 (so your 0.22 was spot-on). How do we know that 3*d/s = 2? That's the default box.ratio value. See what happens if you add box.ratio=3 (or whatever) to y

Re: [R] error in using sample( )

2010-02-21 Thread Peter Ehlers
lease give me some suggestions. Try this: rm(sample) sample(c(0,1,2),1,prob=c(0.2,0.3,0.5)) -Peter Ehlers Thank you Best, Jing __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] a question about the command "followup.plot" of epicale package

2010-02-21 Thread Peter Ehlers
odont is in pkg nlme). -Peter Ehlers On 2010-02-20 19:40, 孟欣 wrote: Hi all: I have a question about the command "followup.plot" of epicale package. As to the demo data "Orthodont", the command "followup.plot" works well.But if I delete some rows of data(delete Male

Re: [R] how do I get the legend?

2010-02-20 Thread Peter Ehlers
). and the cumalative plot as well? And this by studying help(plot). But it appears that you may have to work your way through some introductory material on R first. There's plenty available. Perhaps start with 'An Introduction to R'. -Peter Ehlers

Re: [R] Error message when using error.bars(x,add=TRUE)

2010-02-19 Thread Peter Ehlers
. As a check, I would also do the confidence interval calculations 'by hand'. Or you could provide a *reproducible* example, preferably minimal (i.e. skip the xlab= , etc stuff) and someone might try the code and tell you where the problems lie. -Peter Ehlers Thanks a lot, fussel __

Re: [R] Can R make an usual dotplot

2010-02-18 Thread Peter Ehlers
On 2010-02-18 1:04, Jim Lemon wrote: On 02/18/2010 05:31 PM, Peter Ehlers wrote: I agree with Bill's advice, but if you want the easy way out, try dotplot.mtb in package plotrix. Jim Lemon's done the job for us. In fact, Barry Rowlingson and Rolf Turner did the job, I just bask in

Re: [R] Can R make an usual dotplot

2010-02-17 Thread Peter Ehlers
I agree with Bill's advice, but if you want the easy way out, try dotplot.mtb in package plotrix. Jim Lemon's done the job for us. -Peter Ehlers On 2010-02-17 23:23, bill.venab...@csiro.au wrote: R can't do anything. The question is whether you can do it with R. R puts yo

Re: [R] margin text warning message NAs coercion

2010-02-16 Thread Peter Ehlers
On 2010-02-16 10:18, e-letter wrote: On 16/02/2010, Peter Ehlers wrote: On 2010-02-16 9:21, e-letter wrote: Readers, I tried to the following commands: plot(y~x,ylab=expression(A[1]~B[2],xlab=expression(C~D)) mtext(expression(A[1]~B[2]),"additional text",side=3,line=1) Your plot

Re: [R] margin text warning message NAs coercion

2010-02-16 Thread Peter Ehlers
quot;additional text"),side=3,line=1) -Peter Ehlers I receive the text that I want, but the command terminal shows the following response: Warning message: NAs introduced by coercion in: mtext(expression(A[1]~B[2]),"additional text", side = 3, What is my

Re: [R] Error of Stepwise Regression with number of rows in use has changed: remove missing values?

2010-02-16 Thread Peter Ehlers
models to be based on the same set of subjects.) Finally: (Re-)read the help page and note the 'warning'. -Peter Ehlers ### outputs from R console ### pop<- step( + lm(pop.rate ~ as.numeric(year) + as.factor(policy) + as.numeric

Re: [R] Confidence intervals nls

2010-02-15 Thread Peter Ehlers
m' to 'model' in function(x) sum(vcov(fm)*outer(x,x ? -Peter Ehlers __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html a

Re: [R] rlaplace using rmutil - HELP

2010-02-15 Thread Peter Ehlers
2001) This link might be of some use: http://sci.tech-archive.net/Archive/sci.stat.math/2005-07/msg00229.html -Peter Ehlers __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www

Re: [R] rlaplace using rmutil - HELP

2010-02-15 Thread Peter Ehlers
se rlaplace(3, location, dispersion) With dispDiag, rlaplace is probably taking 's' to be c(3,0,0,0,.20,0,0,0,.1) and is only using the first three elements. (Untested) In case you're not aware: there's also rlaplace() in the VGAM package. -Peter Ehlers

Re: [R] Is this a bug? (layout and par)

2010-02-15 Thread Peter Ehlers
=NA) the output in the left margin is "c(0.5". Does anyone have an explanation? Is this a bug? Can this problem be solved? But ylab is not suppressed. Add ylab="" to your (weird) plot call. -Peter Ehlers Regards, Martin Ivanov __

Re: [R] Plot different regression models on one graph

2010-02-15 Thread Peter Ehlers
le saves typing.) -Peter Ehlers kMan wrote: Dear Peter, Ah, I see your point, Professor. The point at x=23.5 is carrying the model. Allow me to clarify. I was making a similar point. I was suggesting that the cube term could be left in the model, as you did, but rather than dropping the data

Re: [R] Plot different regression models on one graph

2010-02-14 Thread Peter Ehlers
yhat1 <- predict(fm1, list(x = xx)) yhat2 <- predict(fm2, list(x = xx)) plot(x,y) lines(xx, yhat1, col="blue", lwd=2) lines(xx, yhat2, col="red", lwd=2) That's how much difference *one* point makes in a cubic fit! I'm not much of a gambler, so I wouldn'

Re: [R] Difference in Levene's test between R and SPSS

2010-02-14 Thread Peter Ehlers
would consider to be the better test, namely using the median as location measure. lawstat gives you options: try it with location="mean". Then switch to the Fligner-Killeen test (fligner.test() in package 'stats'). The reference cited in ?fligner.test makes for good reading.

Re: [R] Plot different regression models on one graph

2010-02-14 Thread Peter Ehlers
kMan wrote: I would use all of the data. If you want to "drop" one, control for it in the model & sacrifice a degree of freedom. You like to live dangerously. -Peter Ehlers Why the call to poly() by the way? KeithC. -Original Message----- From: Peter Ehle

Re: [R] evaluate variable within expression - how?

2010-02-14 Thread Peter Ehlers
Try text(.5, .5, bquote(bold(.(myText -Peter Ehlers Mark Heckmann wrote: # I want to plot bold text. The text should depend on a variable containing a character string. plot.new() text(.5, .5, expression(bold("Some text"))) # now I would like to do the same replacing &quo

Re: [R] Highlighting points in a quantile plot for different values of a second column

2010-02-13 Thread Peter Ehlers
(20),function(r) r>0.5)) I would like a single curve, the following example displays two curves. qqmath(~x,groups=f,data=x,distribution=qunif,f.value=pp) Here's one way: qqmath(~x, data=x, type='b', col=ifelse(x$f, 2, 4), pch=ifelse(x$f, 17, 19),cex=2) -Peter Ehlers

Re: [R] Plot different regression models on one graph

2010-02-13 Thread Peter Ehlers
And this hasn't even addressed the relative abundance of x=0 data.) -Peter Ehlers David Winsemius wrote: On Feb 13, 2010, at 1:35 PM, Rhonda Reidy wrote: The following variables have the following significant relationships (x is the explanatory variable): linear, cubic, exponenti

Re: [R] Code find exact distribution for runs test?

2010-02-12 Thread Peter Ehlers
[combn() is now in utils] -Peter Ehlers Greg Snow wrote: Here is one quick way using the combinat package: library(combinat) tmpfun <- function(x) { + tmp <- rep(1,5) + tmp[x] <- -1 + tmp + } combn(5,2, tmpfun) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] -1 -1

Re: [R] Function Fstats and p value

2010-02-12 Thread Peter Ehlers
ow to do. You can look inside the plot.Fstats function with strucchange:::plot.Fstats There you will find the equivalent of the following: k <- fs$nreg n <- fs$nobs x <- fs$Fstats pvals <- 1 - pf(x, k, (n - 2 * k)) which gives you the P-values. -Peter Ehlers Here a is an

Re: [R] Switching Axis in Time Series plotting

2010-02-12 Thread Peter Ehlers
Assuming that you are using the xts package, try this: data(sample_matrix) sample.xts <- as.xts(sample_matrix) open <- as.vector(sample.xts[,1]) month <- as.Date(time(sample.xts)) plot(open, month, type="l") -Peter Ehlers JSmaga wrote: Basically it works, but I use

Re: [R] Formatting question for separate polygons

2010-02-12 Thread Peter Ehlers
Nice, Uwe. Small correction: make that nrow=4: x1 <- as.numeric(rbind(matrix(rep(x, each=2), nrow=4), NA)) -Peter Ehlers Uwe Ligges wrote: On 11.02.2010 22:38, Tim Clark wrote: Dear List, I am trying to plot several separate polygons on a graph. I have figured out how to do it

Re: [R] Using seq_len() vs 1:n]

2010-02-12 Thread Peter Ehlers
Pat Burns makes a good point. -Peter Original Message Subject: Re: [R] Using seq_len() vs 1:n Date: Fri, 12 Feb 2010 09:01:20 + From: Patrick Burns To: Peter Ehlers References: <4b746aef.10...@ucalgary.ca> If you want your code to be compatible with S+, then &#

Re: [R] Using sapply on a two argument function

2010-02-11 Thread Peter Ehlers
How about t(outer(seq(.1,1,.1), 1:12, foo)) Convert to dataframe, etc. -Peter Ehlers Steven Worthington wrote: Dear R users, I have a function (simplified here) that accepts two arguments and performs various calculations: foo <- function(y, x) { a <- y*

Re: [R] R ANOVA gives diferent results than SPSS

2010-02-11 Thread Peter Ehlers
simulated/example data if you can't show your real data). -- Peter Ehlers University of Calgary __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/pos

[R] Using seq_len() vs 1:n

2010-02-11 Thread Peter Ehlers
f n can be zero, there is an advantage to using seq_len. Is there ever a *dis*advantage? Peter Ehlers University of Calgary __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-p

Re: [R] trouble with read.table and colClasses='raw'

2010-02-11 Thread Peter Ehlers
_character_ data that you want to read into R where its storage mode should be 'raw'. I don't know how to do that. If the main purpose is to circumvent R's memory requirements, then there have been plenty of posts on that issue. -Peter Ehlers Johan Jackson wrote: "I suspec

Re: [R] trouble with read.table and colClasses='raw'

2010-02-11 Thread Peter Ehlers
clear that you haven't read the colClasses description in ?read.table very carefully. The one thing R help pages are pretty good at is careful definition of arguments. I do hope that your day will improve. -Peter Ehlers [..] -- Peter Ehlers University of Calgary ___

Re: [R] Integral of function of dnorm

2010-02-11 Thread Peter Ehlers
s for lower= and upper= and see if you can understand why -Inf, Inf won't work. You can also plot your function with, e.g. curve(f, 7, 9) -Peter Ehlers Charles Annis, P.E. wrote: Here's a suggestion: Plot the function: x <- seq(3, 13, length=101) plot(x, y=dnorm(x, mean=8,sd=1)

Re: [R] Running rscript in windows

2010-02-11 Thread Peter Ehlers
In addition: Warning message: In file(file, "r", encoding = encoding) : cannot open file 'test.R': No such file or directory -- Peter Ehlers University of Calgary __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/li

Re: [R] Suprising behavior of paste or cat?

2010-02-10 Thread Peter Ehlers
ther this is expected behavior, or whether it ought to be reported as a bug. I don't see the problem in R version 2.10.1 Patched (2010-01-05 r50896) nor in R 2.11.0 Pre-release (Windows Vista). -Peter Ehlers Best, Russell Pierce -- Peter Ehlers University of Calgary _

Re: [R] OrdFacReg

2010-02-10 Thread Peter Ehlers
teger vector? use str(); 3. must NB reside in a matrix? -Peter Ehlers Andrew Kosydar wrote: Hi Dennis, Thank you for your response. No, NB is not a matrix, and I have no covariates. Here's a very small sample of the data: effectNB -0.0032001 -0.1208003 -0.0032002 -7.6

Re: [R] The 'variables' attribute of terms()

2010-02-09 Thread Peter Ehlers
Could somebody let me know what a 'call' class is and what 'language' is? See Chapter 2 in the R Language Definition manual. -Peter Ehlers ## form1=skips ~ Panel * Opening terms1=terms(form1) str(attr(terms1, 'variables')) class(attr(terms1, 'variab

Re: [R] Bar plot

2010-02-09 Thread Peter Ehlers
egards Our Thoughts have the Power to Change our Destiny. Sunita Sent from Pune, MH, India On Tue, Feb 9, 2010 at 11:22 PM, Peter Ehlers wrote: Here is a simple 3-step solution: 1. type ?barplot 2. find the section labelled 'Arguments' 3. carefully read what each argument means/does

Re: [R] subset in a matrix

2010-02-09 Thread Peter Ehlers
es* "x1", etc; as.data.frame(z) is a data.frame with *variables* named "x1" etc. If you really want to use subset(), then subset(z, z[, "x1"] < 0, select = <...>) will work, but I wouldn't use it. -Peter Ehlers DonDiego wrote: Hi, I have a matrix

Re: [R] Bar plot

2010-02-09 Thread Peter Ehlers
o be secretive about the error; just say what it was.) -Peter Ehlers Sunitap22 wrote: Hello (this might be a very simple question) My data is as follows (table name is student) YearStudentsPassed 1 2000300 2 2001360 3 2002450 4 2003450 5 2004270 6 2005280 7

Re: [R] contour & persp

2010-02-09 Thread Peter Ehlers
id 'z' limits So, are some your 'NaN's actually 'Inf's? -Peter Ehlers Uwe Ligges wrote: On 07.02.2010 22:46, Andrew Wang wrote: I have this data set that both x& y are ordered vectors of length 600& 700 respectively; z is a 600 by 700 matrix whose

Re: [R] Wilcoxon signed-ranks test using package coin ?

2010-02-08 Thread Peter Ehlers
e been unable to implement this test using library(coin) - is this possible? Thanks. --Dale Try this: wilcoxsign_test(x ~ rep(M.0, length(x)), dist = 'exact') -- Peter Ehlers University of Calgary __ R-help@r-project.org mailing list ht

Re: [R] About scales in graphics

2010-02-08 Thread Peter Ehlers
d graph in the range 400 and Y in the columns with values below 400 do not appear on the chart? If I understand correctly, you should be able to just subtract 400 from atend and adjust the axis() command: barplot(atend-400, las=1, xlab='Meses', ylab='Número de atendimentos&

Re: [R] Strange "rownames"

2010-02-05 Thread Peter Ehlers
11 Perhaps R should do a bit less coercing. -Peter Ehlers [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.o

Re: [R] Spider Plot color problem

2010-02-05 Thread Peter Ehlers
) -Peter Ehlers IoanLoft wrote: Hi all, I have encountered a problem which appears to have defeated my (admittedly nascent) R skills. I want to draw a spider plot with many cases (just over 300). I am primarily interested in the difference between 4 categories of cases, and want to display them

[R] (Another) Bates fortune?

2010-02-05 Thread Peter Ehlers
t cases" approach to organization of longitudinal data is regrettable." http://n4.nabble.com/Hierarchical-data-sets-which-software-to-use-td1458477.html#a1470430 -- Peter Ehlers University of Calgary __ R-help@r-project.org mailing list https://stat.e

Re: [R] problems with SPC charts in R

2010-02-05 Thread Peter Ehlers
I don't really know qcc, but it seems to me that you might have to provide information about within-group variability. But maybe I'm completely out to lunch on this. -Peter Ehlers vikrant wrote: Thanks Bart and Peter for your help and the example is working for c chart as well

Re: [R] Multiple lines in a graph

2010-02-05 Thread Peter Ehlers
retty well an R-requirement. -Peter Ehlers wesley mathew wrote: Dear All Subject : Multiple Lines in Graph Could you please help me to draw two lines in a graph. plot(f1, t1, type ="b") and plot(f2,t2, type="b") where t1, t2, f1,and f2 are single dimensional matrix. I have these

Re: [R] for loop with if statment problem

2010-02-04 Thread Peter Ehlers
Stephen, You probably should name your dataframe 'dat' and replace the line x <- subset(x, Creek=="fbms" & station==i) with x <- subset(dat, Creek=="fbms" & station==i) -Peter Ehlers stephen sefick wrote: Both of the approx functions w

Re: [R] help needed using t.test with factors

2010-02-04 Thread Peter Ehlers
Tom, t.test(MAE ~ type, data=data, subset=type %in% c('hpc','rfc')) -Peter Ehlers Thomas Adams wrote: Dennis, Thank you for the suggestion, but I get this error: > t.test(MAE ~ type,data=data) Error in t.test.formula(MAE ~ type, data = data) : grouping factor mus

Re: [R] help needed using t.test with factors

2010-02-04 Thread Peter Ehlers
Somehow, in looking for those many examples, you missed the 'sleep' data example on the help page for t.test. (BTW, I wouldn't consider your sample data to be "minimal" or even close to minimal.) -Peter Ehlers Thomas Adams wrote: I am trying to use t.test on the foll

Re: [R] mgcv problem to load

2010-02-04 Thread Peter Ehlers
some funny thing in your startup. Anyway, try deleting .Random.seed and re-creating it: rm(.Random.seed) runif(1) -Peter Ehlers Rosa Manrique wrote: Dear friends, I cannot load the pachkages labdsv...which i do not understand is linked to 'mgcv' package. Anyway neither the last is loa

Re: [R] Histogram function from lattice package

2010-02-04 Thread Peter Ehlers
Is this what you want: singer1 <- subset(singer, voice.part == "Bass 1") brks <- seq(65, 75, 2) histogram( ~ height, data = singer1, breaks = brks) or, slightly different: histogram( ~ height, data = singer1, breaks = brks, scales = list(x = list(at = brks))) -Peter Eh

Re: [R] problems with SPC charts in R

2010-02-04 Thread Peter Ehlers
I suspect that you may have set qcc.options("cex") to too large a value. Try lowering it with qcc.options(cex=whatever) -Peter Ehlers vikrant wrote: ok. I will give the example for which i m getting this error. The data for plotting R chart and S chart is very huge. SO i will ta

Re: [R] [Fwd: question on plot in R with mac]

2010-02-04 Thread Peter Ehlers
ls package is what you want. -Peter Ehlers thank you khazaei __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, min

Re: [R] strange behaviour of median

2010-02-04 Thread Peter Ehlers
han a bug. I must admit, I've never run across this situation. Good of you to spot it. -Peter Ehlers If you consider data.frame an unusual class I could accept your point but if help page tells me that a function works for most classes I would not expect that data.frame class shall b

Re: [R] comparison of parameters for nonlinear regression

2010-02-04 Thread Peter Ehlers
ok by Bates and Watts. As always, the most important questions are 1) why do you want to compare models and 2) what will you do with the result of the comparison. -Peter Ehlers Thanks in advance __ R-help@r-project.org mailing list https://stat.eth

Re: [R] strange behaviour of median

2010-02-04 Thread Peter Ehlers
e: median.data.frame <- function(x, ...) sapply(x, median, ...) I think that it would be desirable to have similar behaviour for both functions or at least a warning if median.default is incorrectly applied to a data.frame object. -Peter Ehlers r-help-boun...@r-project.org napsal dne 04.02.20

Re: [R] Error with write.table

2010-02-02 Thread Peter Ehlers
s a dataframe? Use class(myData) before the write.* call. Use write.csv() (this won't fix the 'problem'). -Peter Ehlers Many thanks in advance! John Woodard -- Peter Ehlers University of Calgary __ R-help@r-project.org mailing list

Re: [R] Error with toString

2010-02-02 Thread Peter Ehlers
7;): [1] toString.default Warning message: In methods("toString") : function 'toString' appears not to be generic - Anna Lippel -- Peter Ehlers University of Calgary __ R-help@r-project.org mailing list https://stat.ethz.ch/mai

Re: [R] Error with toString

2010-02-02 Thread Peter Ehlers
nyway, here are two suggestions: 1. to answer your question directly: use base::toString(x) to enforce use of that function. 2. try methods('toString') to see what other toString()'s you may have around. -Peter Ehlers anna wrote: isn't there a way to specify from which

Re: [R] List of object properties

2010-02-02 Thread Peter Ehlers
Philipp, Check ?str which displays the structure of R objects. And do use extractor functions when available: coef(yourModel) instead of yourModel$coef -Peter Ehlers Philipp Rappold wrote: Dear all, I have a simple question: How can I retrieve a list with all properties of an object

Re: [R] Subset and point plot

2010-02-02 Thread Peter Ehlers
u get from c("red","blue","purple","pink")["a4"] 4. assuming that 'Tanks' is a factor, see what you get from c("red","blue","purple","pink")[Tanks] -Peter Ehlers Marlin Keith Cox wrote: OK

Re: [R] Error with toString

2010-02-02 Thread Peter Ehlers
Anna, Try omitting pkg:RBloomberg. If you really need to use that package, you will have to install the non-CRAN package RDCOMClient from omegahat. I still don't see why toString() wouldn't do its job, even with RBloomberg loaded. -Peter Ehlers anna wrote: Here is the list of

<    5   6   7   8   9   10   11   12   13   >