Re: [R] wilcox_test function in coin package

2013-05-31 Thread Peter Ehlers
be a problem, but to avoid it you could use exactRankTests::wilcox.exact() which, I believe, was written by the same author. It uses the same syntax as wilcox.test(). Note, though, that the package is no longer being developed. Peter Ehlers On Thu, May 30, 2013 at 6:21 PM, Greg Snow 538

Re: [R] T statistic exactRankTests package

2013-05-30 Thread Peter Ehlers
is there some way to look for what function is used to calculate the statistics? Just look at the code of perm.test.default (it's not complicated). Type perm.test.default to see the code or get the package source and study the code. Peter Ehlers __ R

Re: [R] zigzag confidence interval in a plot

2013-05-17 Thread Peter Ehlers
$Depth, ylim = rev(range(0:100)), xlab=CHAO, ylab=Depth, pch=15, las=2, main=Sep12-RNA, cex.main=1) abline(lmR) lines(cd$CHAOsep12RNA, a[,2], lty=2) But I see both cases kind of zigzags. What can it be the reason? thank you! Sort your dataframe by x-values (CHAOsep12RNA). Peter Ehlers

Re: [R] pearson correlation significant level

2013-05-17 Thread Peter Ehlers
in the calculation, see any intro stats text or look at the code of cor.test.default(). Peter Ehlers Prof. José Iparraguirre Chief Economist Age UK -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Elaine Kuo Sent: 17 May 2013 10:40 To: r

Re: [R] Bivariate - multivariate linear regression

2013-05-17 Thread Peter Ehlers
#[1] tol14 tol15 To construct the formula: rhs - paste(use, collapse = + ) form - paste(exposure ~, rhs) And then use it: fit_multi - lm(formula = form, data = tolerance) Peter Ehlers __ R-help@r-project.org mailing list https://stat.ethz.ch

Re: [R] linear model coefficients by year and industry, fitted values, residuals, panel data

2013-04-04 Thread Peter Ehlers
Carmo According to the plyr NEWS file, mutate was introduced in Version 1.3 (2010-12-28). I would hope that your version is newer than that. You should tell us what the error message is. Anyway, you can always use R's within() function instead; or use transform() as Jean suggested. Peter Ehlers

Re: [R] linear model coefficients by year and industry, fitted values, residuals, panel data

2013-04-03 Thread Peter Ehlers
in the plot: boxplot(residual ~ firm, data = newdata) Peter Ehlers On Wed, Apr 3, 2013 at 3:38 AM, Cecilia Carmo cecilia.ca...@ua.pt wrote: Hi R-helpers, My real data is a panel (unbalanced and with gaps in years) of thousands of firms, by year and industry, and with financial information

Re: [R] {Spam?} Re: linear model coefficients by year and industry, fitted values, residuals, panel data

2013-04-03 Thread Peter Ehlers
'. But try it for an nls model. Mynlsmodel$coefficients won't work (well, it won't give an error but it will yield NULL). That's why there are special extractor functions such as coef.nls, coef.Arima, etc. For lm models, coef.default is used. Peter Ehlers For suggestion 2, thanks! I'm new

Re: [R] Can package plyr also calculate the mode?

2013-04-03 Thread Peter Ehlers
and then do findFn(mode) to see what's available. E.g. packages, pracma, asbio, dprep, rattle and many others. Do note that they handle the multimodal situation differently. Or, write your own, perhaps using table() and which.max(). Peter Ehlers all1 - ddply(all,ACT_NAME, summarise, mean=mean

Re: [R] Factor to numeric conversion - as.numeric(as.character(f))[f] - Language definition seems to say to not use this.

2013-04-01 Thread Peter Ehlers
calculations easier. This, however, is an implementation issue and is not guaranteed to hold in all implementations of R. Hint: f - factor(sample(5, 10, TRUE)) as.numeric(levels(f))[f] g - factor(sample(letters[1:5], 10, TRUE)) as.numeric(levels(g))[g] Peter Ehlers [[alternative HTML

Re: [R] Console display buffer size

2013-04-01 Thread Peter Ehlers
-change may perhaps have to be determined empirically). Isn't this set by the 'bufbytes' and 'buflines' specifications in the Rconsole file? Anyway, it's probably best to use 'View' to inspect data. Peter Ehlers With thanks, Ted. - E-Mail: (Ted

Re: [R] expression

2013-04-01 Thread Peter Ehlers
)) and I usually find it much more flexible to add the title with a separate title(titt) call. 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

Re: [R] Factor to numeric conversion - as.numeric(levels(f))[f] - Language definition seems to say to not use this.

2013-04-01 Thread Peter Ehlers
() function. Peter Ehlers On Mon, Apr 1, 2013 at 2:58 PM, Bert Gunter gunter.ber...@gene.com mailto:gunter.ber...@gene.com wrote: Yup. Note also: as.character.factor function (x, ...) levels(x)[x] But of course this is OK, since this can change if the implementation does

Re: [R] Console display buffer size

2013-04-01 Thread Peter Ehlers
On 2013-04-01 15:06, Ted Harding wrote: On 01-Apr-2013 21:26:07 Robert Baer wrote: On 4/1/2013 4:08 PM, Peter Ehlers wrote: On 2013-04-01 13:37, Ted Harding wrote: Greetings All. This is a somewhat generic query (I'm really asking on behalf of a friend who uses R on Windows, whereas I'm

Re: [R] How to remove all characters after comma in R

2013-04-01 Thread Peter Ehlers
On 2013-04-01 19:23, arun wrote: gsub(\\,.*,,x) #[1] foo bar qux A.K. No big deal, but does , have to be escaped? sub(,.*, , x) Peter Ehlers - Original Message - From: Gundala Viswanath gunda...@gmail.com To: r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Cc: Sent: Monday

Re: [R] Plotting histogram of RT data

2013-03-31 Thread Peter Ehlers
to check is range(x[, 17]) It's also _always_ a good idea to check str(x) before you do anything further with x. Peter Ehlers [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r

Re: [R] About name of list elements

2013-03-25 Thread Peter Ehlers
To the OP: Sooner or later most R beginners are bitten by this all too convenient shortcut. As an R newbie, think of R as your bank account: overuse of $-extraction can lead to undesirable consequences. It's best to acquire the '[[' and '[' habit early. Peter Ehlers On 2013-03-25 12:43, Bert

Re: [R] A question on function return

2013-03-22 Thread Peter Ehlers
how to achieve that? From help(ifelse): ifelse returns a value with the same shape as test i.e. in your case, the same 'shape' as 'x 0', a single value. You _could_ make ifelse() work with, e.g., ifelse(rep(x, 6) 0, ) but you probably want if() instead. Peter Ehlers

Re: [R] How to get the rolling standard deviation in rasters?

2013-03-19 Thread Peter Ehlers
= fun, filename = filename, ...) : cannot use this formula, probably because it is not vectorized [...snip...] This suggests that it might be useful to read ?Vectorize. Peter Ehlers __ R-help@r-project.org mailing list https

Re: [R] Cumulative Frequency Graph

2013-03-19 Thread Peter Ehlers
! ?axis will show you how to use the 'at' and 'labels' arguments of the axis() function. Peter Ehlers On Tue, Mar 19, 2013 at 2:00 PM, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, Try setting the argument xaxt (x axis type) to n (no x axis) and then use ?axis. plot(breaks, cumfreq0

Re: [R] nlrob and robust nonlinear regression with upper and/or lower bounds on parameters

2013-03-15 Thread Peter Ehlers
a shift to accommodate coef k for given k is simple. 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 and provide commented

Re: [R] nlrob and robust nonlinear regression with upper and/or lower bounds on parameters

2013-03-15 Thread Peter Ehlers
Forgot to mention: You might find the nlmrt package helpful but I have no experience with that (yet). Peter Ehlers On 2013-03-15 07:57, Shane McMahon wrote: I have a question regarding robust nonlinear regression with nlrob. I would like to place lower bounds on the parameters, but when I

Re: [R] Error message in vars package

2013-03-14 Thread Peter Ehlers
): [1] grid_2.15.3 lattice_0.20-13 tools_2.15.3 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 and provide commented, minimal

Re: [R] expression exponent labeling

2013-03-13 Thread Peter Ehlers
, if you need to do this a lot, you could create an expression vector: x - -8:-3 z - vector(expression, 6) for(i in 1:6) z[[i]] - bquote(10^.(x[i])) axis(1, x, z) Peter Ehlers On Wed, 13 Mar 2013, Berry Boessenkool wrote: Hi all, I want to label an axis with exponents, but can't get it done

Re: [R] Determining maximum hourly slope per day

2013-03-13 Thread Peter Ehlers
(slope, na.rm = TRUE) idx - which.max(slope) Obviously, this can be extended to cover more than a 24-hour period. Now, let's wait for Gabor to show us the trivial way with zoo::rollapply. Peter Ehlers __ R-help@r-project.org mailing list https

Re: [R] Troubleshooting code

2013-03-12 Thread Peter Ehlers
. [... rest of code sample snipped ...] 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 and provide commented, minimal, self-contained

Re: [R] Constrain slope in segmented package

2013-03-12 Thread Peter Ehlers
for ?update.formula where you can read all about it. 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 and provide commented, minimal, self-contained

Re: [R] funtion equivalent of jitter to move figures on device

2013-03-12 Thread Peter Ehlers
, it should be possible to use locator() to place each plot. 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 and provide commented

Re: [R] Troubleshooting code

2013-03-12 Thread Peter Ehlers
ate kids. 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 and provide commented, minimal, self-contained, reproducible code.

Re: [R] Stretch the y axis in levelplot

2013-03-12 Thread Peter Ehlers
could set the argument 'aspect' to 'fill' instead of 'iso'. 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 and provide commented

Re: [R] Re move row.names column in dataframe

2013-03-11 Thread Peter Ehlers
On 2013-03-11 06:07, Jorgen Harmse wrote: identical(df[1,],df[2,]) is FALSE because of the row names. all( == ) is just a work-around that I attempted. Jorgen. I would just wrap the elements in c(): identical( c(df[1,]), c(df[2,]) ) Peter Ehlers On Mar 11, 2013, at 02:53 , PIKAL Petr

Re: [R] plot pch

2013-03-11 Thread Peter Ehlers
' and pch-vector 'ch': with(dat, plot(x, y, pch = ch[z])) with(dat, text(x, y, lab=z, pos=3, cex=.7)) Try also pos=1,2,4 to see what suits you best. Peter Ehlers Date: Mon, 11 Mar 2013 21:33:33 + From: ruipbarra...@sapo.pt To: eliza_bo...@hotmail.com CC: r-help@r-project.org Subject: Re

Re: [R] aggregate(), tapply(): Why is the order of the grouping variables not kept?

2013-03-11 Thread Peter Ehlers
factor vary most rapidly, then the next, etc. I think that's documented somewhere, but I don't know where. 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

Re: [R] R for Card Game Modeling

2013-03-10 Thread Peter Ehlers
, victory points) each obeying a given set of rules. The purpose of the statistical analysis is to come up with a measure of the strength of each card. Any idea if out there there is any R package/script which can help me? Any suggestion is welcome Lorenzo Why not simulate? Peter Ehlers

Re: [R] Unexpected behavior looping through sequence of dates

2013-03-09 Thread Peter Ehlers
. 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 and provide commented, minimal, self-contained, reproducible code.

Re: [R] Difficulty in caper: Error in phy$node.label[which(newNb 0) - Ntip]

2013-03-07 Thread Peter Ehlers
with negative subscripts Looks to me like 'which(newNb 0) - Ntip' evaluates to a vector that has both positive and negative elements. Like this: x - 1:5 x[c(-2,-4)] ## ok x[c(-2, 0)] ## ok x[c(-2, 4)] ## generates your error Peter Ehlers -- Nicole A Thompson E3B Columbia

Re: [R] Troubles with labeling x axis

2013-03-06 Thread Peter Ehlers
, at=seq(1,40,4), labels=seq(1,10,1)) Thanks in advance for any help! Have a look at what par(usr) gives to see that your at setting makes no sense. Peter Ehlers __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] Inverse function using FDA

2013-03-06 Thread Peter Ehlers
or another designed for functional data analysis. Thanks, Zoe Richards What does your question mean? Possibly, you could 'invert' a mean function, but I have no idea what that would accomplish. Can you provide an example of just what you want to do? Peter Ehlers

Re: [R] Wilcox-Off?

2013-03-05 Thread Peter Ehlers
. 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 and provide commented, minimal, self-contained, reproducible code.

Re: [R] SAS and R complement each other

2013-03-04 Thread Peter Ehlers
for approval) Peter Ehlers [...snip...] __ 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, minimal, self-contained

Re: [R] SAS and R complement each other

2013-03-04 Thread Peter Ehlers
On 2013-03-04 12:30, David Winsemius wrote: On Mar 4, 2013, at 12:18 PM, Peter Ehlers wrote: On 2013-03-04 12:04, Ista Zahn wrote: On Mon, Mar 4, 2013 at 2:57 PM, Rolf Turner rolf.tur...@xtra.co.nz wrote: I never saw the original note nor its resubmission. Nor could I find it in the R

Re: [R] Expressions in lattice conditional variables

2013-03-02 Thread Peter Ehlers
that this isn't totally out to lunch. Peter Ehlers On 2013-03-02 09:20, Frank Harrell wrote: Whoops - these 2 lines should have been omitted from the program: n - sprintf('%s (n%s=%g, n%s=%g)', v, nam[1],n[1], nam[2],n[2]) vn[var == v] - n Frank Harrell wrote I would like to have a lattice

Re: [R] using reserved words in R, and reuse variable names in different functions

2013-03-02 Thread Peter Ehlers
Duncan's comment may not qualify as a fortune, but it did make me chuckle. Peter Ehlers On 2013-03-02 03:01, Duncan Murdoch wrote: On 13-03-01 8:35 PM, C W wrote: [...snip...] pie is a function, but all it does is draw pie charts, so who cares if you mask it? :-). Duncan Murdoch [...snip

Re: [R] solving x in a polynomial function

2013-03-01 Thread Peter Ehlers
- realroots(po.lm, 3) predict(po.lm, newdata = data.frame(b = r)) # confirm 1 1.69 So I think there's a calculation error somehwere. You need to replace the following line if(names(model)[1] == (Intercept)) with if(names(coef(model))[1] == (Intercept)) Peter Ehlers On 3/1/13, arun

Re: [R] resizing panels but some strip letters disappeared (dotplot)

2013-03-01 Thread Peter Ehlers
remaining when resizing panels. Thank you. Elaine [[alternative HTML version deleted]] I think that you should provide (minimal) code to illustrate the problem. Peter Ehlers __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman

Re: [R] put strip below the panel (dotplot)

2013-02-28 Thread Peter Ehlers
(xleft, ybottom, xright, ytop, fill = bisque) panel.text(x = (xleft + xright) / 2, y = (ybottom + ytop) / 2, labels = lab) }) Peter Ehlers __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman

Re: [R] Parallel computation in R

2013-02-25 Thread Peter Ehlers
it on your search path. This should do it: library(parallel) -- Peter Ehlers computing on windows? Thanks for your help. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R

Re: [R] lattice: column titles using xlab.top in multipanel xyplot

2013-02-25 Thread Peter Ehlers
in the top strips, using the factor.levels argument. But perhaps your real use is more involved than the example. 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

Re: [R] locating boxplot in bwplot (lattice)

2013-02-24 Thread Peter Ehlers
~ height, data = singer, fill = mycol) 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 and provide commented, minimal, self

Re: [R] How to define variables as categorical using Gower with Daisy

2013-02-24 Thread Peter Ehlers
to specify the variable types correctly? Thank you. Joanna 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 and provide commented

Re: [R] levelplot

2012-12-30 Thread Peter Ehlers
on the levelplot help page. 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 and provide commented, minimal, self-contained, reproducible code.

Re: [R] Display of data points in the Scatterplot

2012-12-22 Thread Peter Ehlers
in the TeachingDemos package. Peter Ehlers (B) Suppose I have 100 pairs of (x, y ). then is it possible to display in the graph (irrespective of the curosr position) the values of (x, y) corresponding to say 10th, 20th, 30th, 40th etc. observations in the graph. ?text

Re: [R] Plot with residuals in mgcv

2012-11-28 Thread Peter Ehlers
' dimensions. I don't see why, but since the 'residuals' argument to plot.gam() can be an array _of the correct length_ (see ?plot.gam), it just might be that you have an object called 'T' hanging around, in which case using 'T' in place of 'TRUE' is a bad idea. Actually, it's _always_ a bad idea. Peter

Re: [R] GLM Coding Issue

2012-11-27 Thread Peter Ehlers
: see MASS (the book, 4ed) page 191; also found in the ch07.R file in the /library/MASS/scripts folder. I seem to recall that this is mentioned somewhere in the docs, but put my finger on it now. One additional comment about the analysis: overdispersion might be a problem. Peter Ehlers

Re: [R] Add column index number to str() output

2012-11-23 Thread Peter Ehlers
you're in the habit of processing your data by column _number_ rather than variable _name_. If so, I would strongly discourage that habit. And a cursory look at str.default() suggests that it may not be all that trivial a code change. Peter Ehlers __ R-help

Re: [R] subsetting - questions

2012-11-23 Thread Peter Ehlers
. And !drop_var doesn't work because you need something that evaluates to a logical value if you want to ! it. This will do it: df[df$X1=8,] [, !names(df) %in% drop_var] Or use the subset() function, as Jorge suggests. Peter Ehlers __ R-help@r

Re: [R] [lattice] Increase distance between tick labels and ticks in wireframe plot (pad)

2012-11-22 Thread Peter Ehlers
), distance =c(2, 5, 8))) Adjust as you prefer. 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 and provide commented, minimal, self

Re: [R] lubridate concatenation issue

2012-11-16 Thread Peter Ehlers
of that attribute. Peter Ehlers - Original Message - From: Andre Zege az...@yahoo.com To: r-help@r-project.org r-help@r-project.org Cc: Sent: Thursday, November 15, 2012 9:36 PM Subject: [R] lubridate concatenation issue I took a look at Hadley's lubridate which seems a very neat

Re: [R] create function to solve derivative

2012-11-16 Thread Peter Ehlers
use of the semicolon to place two R expressions on one line. He neither needs nor wants the ';dx2dx' in his own expressions. Peter Ehlers __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Importing Data for a two sample t-test

2012-11-15 Thread Peter Ehlers
analyses. Just use the formula version of t.test(). Peter Ehlers -- View this message in context: http://r.789695.n4.nabble.com/Importing-Data-for-a-two-sample-t-test-tp4649565.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r

Re: [R] Compraring two independent samples

2012-11-15 Thread Peter Ehlers
are not Normal, I don't see why a t-distribution would be expected. I seem to recall that Welch included some simulation results in his Biometrika paper (1947? 1953?; I'm getting senile). Shouldn't be difficult to generate in R. Maybe Greg Snow's TeachingDemos package has something. Peter Ehlers

Re: [R] lubridate concatenation issue

2012-11-15 Thread Peter Ehlers
' attribute. This is mentioned on the help page for POSIXct. The only way I know to 'fix' this is to reassign the attribute: e - c(d) attr(e, tzone) - UTC But there might a better solution to whatever the real problem is. Peter Ehlers __ R-help@r

Re: [R] Switch Groups in ehplot (x-axis)

2012-11-14 Thread Peter Ehlers
guess that 'Groups' is a factor variable and that you have not set its levels explicitly to be what you want. See ?levels Peter Ehlers -- View this message in context: http://r.789695.n4.nabble.com/Switch-Groups-in-ehplot-x-axis-tp4649485.html Sent from the R help mailing list archive

Re: [R] How to permanently change console colours in R

2012-11-13 Thread Peter Ehlers
updating your R version. 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 and provide commented, minimal, self-contained

Re: [R] A question on xyplot function in Lattice package

2012-11-07 Thread Peter Ehlers
) (type g indicates a grid, but the 'grid' argument is preferred.) 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 and provide commented

Re: [R] Changing radii line type in radial plots

2012-10-30 Thread Peter Ehlers
that will permit different colours for the circles/radii is left as an exercise. Peter Ehlers On Fri, Oct 26, 2012 at 10:59 AM, Peter Ehlers ehl...@ucalgary.ca wrote: On 2012-10-25 14:42, Bernie Wone wrote: Hi Peter, Thanks for the help. Being a beginner R user with little programming experience, once

Re: [R] Creating a correlation matrix from a vector

2012-10-26 Thread Peter Ehlers
it easiest to start with a matrix of zeros, fill in the upper.tri part as you have done, then just add newmat and t(newmat), then fix the diagonal. Peter Ehlers __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] regression analysis in R

2012-10-26 Thread Peter Ehlers
. thanks in advanceeliza I hope that you're doing _exploratory_ data analysis. Have a look at the 'leaps' package. It might be suitable. Peter Ehlers __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] Grid Width in polar.plot

2012-10-26 Thread Peter Ehlers
' with 'myradial.plot' and save the edited version as 'mypolar.plot', say. Now use mypolar.plot() with whatever grid.lwd value suits your purpose. Peter Ehlers -- View this message in context: http://r.789695.n4.nabble.com/Grid-Width-in-polar-plot-tp4647547.html Sent from the R help mailing list

Re: [R] Understanding lattice barchart() display

2012-10-24 Thread Peter Ehlers
, data = benthos, FUN = sum) Then just use benthos2 as the data argument to barchart(). 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

Re: [R] Changing radii line type in radial plots

2012-10-24 Thread Peter Ehlers
On 2012-10-23 15:22, bwone wrote: Hello all, Is it possible to change the radii line type in radial plots? I wasn't able to find anything online. Do please be more specific: which package's radial plot function are you using? Package plotrix has radial.plot() with an 'lty' argument. Peter

Re: [R] Changing radii line type in radial plots

2012-10-24 Thread Peter Ehlers
) segments(0, 0, xpos, ypos, col = grid.col) and add the argument 'lty = grid.lty' to each. Then add 'grid.lty = 1' to the function arguments. Save the modified function as myradial.plot and source() it into your R session and then use it with whatever grid.lty setting you prefer. Peter Ehlers

Re: [R] Selecting n observation

2012-10-11 Thread Peter Ehlers
, INDICES=df$ID, FUN=function(DF) DF[which.max(DF$week), ])) ID week outcome 1 16 42 4 4 12 85 9 9 12 84 With the plyr package: library(plyr) ddply(df, .(ID), function(x) tail(x, 2)) or, slightly simpler: ddply(df, .(ID), tail, 2) Peter Ehlers

Re: [R] a merge() problem

2012-10-07 Thread Peter Ehlers
--- why is the suffixes argument ignored? I mean, I expected that the second a to be a.y. The 'suffixes' argument refers to _non-by_ names only (as per ?merge). Peter Ehlers (when I omit suffixes, the result is the same). Thanks. __ R-help@r

Re: [R] a merge() problem

2012-10-07 Thread Peter Ehlers
On 2012-10-07 10:50, arun wrote: Hi, Though, this does give the result you wanted when the column names are the same. y1-y colnames(y1)-c(a,b) merge(x,y1,by=a,all=TRUE,suffixes=c(,.y)) # a b b.y #1 1 4a #2 2 5b #3 3 6 NA A.K. Yes, because 'b' is _not_ a 'by'-name. Peter Ehlers

Re: [R] a merge() problem

2012-10-07 Thread Peter Ehlers
On 2012-10-07 14:44, Sam Steingold wrote: * Peter Ehlers ruy...@hpnytnel.pn [2012-10-07 10:03:42 -0700]: On 2012-10-07 08:34, Sam Steingold wrote: I know it does not look very good - using the same column names to mean different things in different data frames, but here you go: --8

Re: [R] Count based on 2 conditions [Beginner Question]

2012-09-16 Thread Peter Ehlers
: count - sum(with(x, A*B 5)) Peter Ehlers Hope this helps, Rui Barradas Em 16-09-2012 11:41, SirRon escreveu: Hello, I'm working with a dataset that has 2 columns and 1000 entries. Column 1 has either value 0 or 1, column 2 has values between 0 and 10. I would like to count how often Column 1

Re: [R] Sub- or superscript in factorial variable - possible?

2012-09-16 Thread Peter Ehlers
(1,1, xlab=expression(phantom()^32m*K) ) Error: unexpected symbol in plot(1,1, xlab=expression(phantom()^32m plot(1,1, xlab=expression(phantom()^32m*K) ) # succeeds I think what PD was trying to say is that a preferred solution would be: plot(1,1, xlab=expression(phantom()^{32*m}*K) ) Peter

Re: [R] what package does the mesh function need

2012-09-04 Thread Peter Ehlers
) as you have done in your post. And what makes you think that there _should_ be a function mesh()? The answer to that question may well provide a sufficient clue to its whereabouts. Finally, searching for functions is relatively simple with the findFn() function in the sos package. Peter Ehlers

Re: [R] Horizontal grid in background of barplot

2012-09-03 Thread Peter Ehlers
of the legend region. barplot(x,beside=TRUE, ylim=c(0,90)) abline(h=c(seq(10,90,10))) box() barplot(x,beside=TRUE, xlab=Ailment, ylab=Percent, legend.text=TRUE, args.legend=list(topright,title=Treatment,bg=white), add=TRUE) Peter Ehlers

Re: [R] boxplot - bclust

2012-09-03 Thread Peter Ehlers
$datamean)) Peter Ehlers Thank you for your help. Best regards, Dominic [[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

Re: [R] how to find the index of points selected from a scatter plot?

2012-08-31 Thread Peter Ehlers
On 2012-08-31 16:03, Bert Gunter wrote: ?which ## as in ix - which(x==values) -- Bert Or maybe ?identify. Peter Ehlers On Fri, Aug 31, 2012 at 2:09 PM, Michael comtech@gmail.com wrote: Hi all, I am using locator to select the points from a scatter plot... This is all fine

Re: [R] predict.lm(...,type=terms) question

2012-08-29 Thread Peter Ehlers
I think that what the OP is looking for comes under the heading of inverse regression or the calibration problem. One reference with a simple explanation including confidence intervals is Applied regression analysis by Draper and Smith. (It's in section 3.2 in my 3rd edition). Peter Ehlers

Re: [R] Help on calculating spearman rank correlation for a data frame with conditions

2012-08-29 Thread Peter Ehlers
- data.frame(g=gl(5, 10), x=rnorm(50), y=rnorm(50)) by(d[,2:3], d$g, cor, method=spearman) It may seem a bit of overkill, but the plyr package is handy and gives a nice output: library(plyr) ddply(d, .(g), summarize, correlation = cor(x, y, method = 's')) Peter Ehlers

Re: [R] don't print object attributes

2012-08-28 Thread Peter Ehlers
want to keep (e.g. the names), but otherwise works on your example. Duncan Murdoch It seems that class listof also works: class(x) - listof x Peter Ehlers x $setosa x[, Sepal.Length] n missing uniqueMean .05 .10 .25 .50 .75 50 0 15

Re: [R] Inexplicably different results using subset vs bracket notation on logical variable

2012-08-28 Thread Peter Ehlers
that the page is clear: ... NA index picks an unknown element and so *returns* NA in the corresponding element of ... (my emphasis) Isn't that exactly what occurs? Peter Ehlers Thanks again, Mauricio [[alternative HTML version deleted

Re: [R] Lattice graphics adding abline line (1:1 line) ???

2012-08-28 Thread Peter Ehlers
,...) }, key = list(corner = c(1,0), text = list(lab = levels(iris[[Species]])), points = list(pch = 15:17, col = 2:4))) If you use panel.abline for regression lines, be sure to specify the regression formula with the reg= argument. Peter Ehlers

Re: [R] {Spam?} Re: help with a special variant of balloonplot

2012-08-26 Thread Peter Ehlers
) Peter Ehlers I will try to dig into the code to see how this new parameter can be accomodated into the code. I must confess that I am far from a pro at this sort of stuff. I will appreciate it if I can get some help. However, I will also give it a try myself. Will come back later if I run

Re: [R] sourcecode for the balloonplot function from the gplots package

2012-08-25 Thread Peter Ehlers
with your favourite decompression utility. 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 and provide commented, minimal, self

Re: [R] help with a special variant of balloonplot

2012-08-25 Thread Peter Ehlers
) statement and use with(survived, myballoonplot()) Peter Ehlers I will appreciate any help that I can get. Thanks, Ravi [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] Extracting data from dataframe with tied rows

2012-08-24 Thread Peter Ehlers
Here's another pretty straightforward solution, using the plyr pkg: DF - data.frame(id, month, distance, bearing) # variables as defined in the OP require(plyr) DF1-ddply(DF, .(id,month), summarize, maxdist = max(distance), maxbearing = bearing[which.max(distance)]) Peter

Re: [R] ifelse problem - bug or operator error

2012-08-24 Thread Peter Ehlers
. the four suspect cases came out just as they should). But what my mailer provides as your data may not be what you really have. Oh, and get a bandage for that head bruise. Peter Ehlers WWHHH Why why why why why why why? Why? (Sorry, I've been trying to figure this out for hours

Re: [R] ifelse problem - bug or operator error

2012-08-24 Thread Peter Ehlers
, my_flag = ( (PM.EXP 0) (PM.DIST.TOT != 1) ) * 1 ) It looks as though your PM.DIST.TOT variable is meant to be integer. If so, you might want to ensure that it is that type. Otherwise, you might want to use Michael's suggestion of using abs(... - 1) 1e-05. Peter Ehlers On 2012-08-24 14:56, Jennifer

Re: [R] NLS bi exponential Fit

2012-08-23 Thread Peter Ehlers
Have you checked help(SSbiexp) ? Peter Ehlers On 2012-08-23 04:54, vincent guyader wrote: Hi everyone, I'm trying to perform a bi exponential Fit with the package NLS. the plinear algorithm seems to be a good choice see: p-3000 q-1000 a--0.03 b--0.02 t-seq(0:144);t y-p*exp(a*t) + q*exp(b*t

Re: [R] Controlling line-join style in Lattice

2012-08-22 Thread Peter Ehlers
You can set grid parameters in the grid.pars component of trellis.par.get(). x - 1:4; y - c(1,3,2,4) xyplot(y ~ x, type = l, lwd = 20) # default linejoin ## set linejoin to 'mitre' trellis.par.set(grid.pars = list(linejoin = mitre)) xyplot(y ~ x, type = l, lwd = 20) Peter Ehlers On 2012

Re: [R] Controlling line-join style in Lattice

2012-08-22 Thread Peter Ehlers
I should add that you can also use the par.settings() mechanism to set your linejoin specification on the fly: x - 1:4; y - c(1,3,2,4) xyplot(y ~ x, type = l, lwd = 20, par.settings = list(grid.pars = list(linejoin = mitre))) Peter Ehlers On 2012-08-22 12:28, Peter Ehlers wrote: You can

Re: [R] Inserting superscripts in free-format text line

2012-08-21 Thread Peter Ehlers
the quote symbols with the word. 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 and provide commented, minimal, self-contained

Re: [R] ncdf - writing variable to a file

2012-08-21 Thread Peter Ehlers
On 2012-08-21 11:02, m p wrote: Hello, I have a problem writing a variable to an existing file. Below is a part of my script and how it fails. I can't find create.var.ncdf in help You probably want 'create.ncdf'. Peter Ehlers Thanks for any help. Mark nc - open.ncdf(ncname, readunlim=FALSE

Re: [R] Inserting superscripts in free-format text line

2012-08-20 Thread Peter Ehlers
.)) or text(x=1, y=11, expression(This is a * test^1 * of the Emergency Broadcast System.)) If one is going to use plotmath expressions frequently, then these two handy little symbols are worth knowing. Peter Ehlers Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com

Re: [R] The difference between chisq.test binom.test and pbinom

2012-08-20 Thread Peter Ehlers
of an outcome that is 5 units *less* (or lower) than the EV: pbinom(52, 112, .512) # 0.1799121 Add the two probabilities to get: 0.2161936 + 0.1799121 # 0.3961057 and that's what binom.test() reports. For details, have a look at the binom.test code. Peter Ehlers I'd be happy to know what I

  1   2   3   4   5   6   7   8   9   10   >