Re: [R] wilcox_test function in coin package

2013-05-31 Thread Peter Ehlers
ntax would 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

Re: [R] T statistic exactRankTests package

2013-05-30 Thread Peter Ehlers
uld check Wikipedia for "permutation test". There must be plenty of online info but I'm too lazy to check. In general 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 no

Re: [R] Bivariate - multivariate linear regression

2013-05-17 Thread Peter Ehlers
ce)[2:6] pvec <- c(lmp(fit), lmp(fit_2), lmp(fit_3), lmp(fit_4), lmp(fit_5)) use <- varnames[pvec < 0.15] use #[1] "tol14" "tol15" To construct the formula: rhs <- paste(use, collapse = " + ") form <- paste("exposure ~", rhs) A

Re: [R] pearson correlation significant level

2013-05-17 Thread Peter Ehlers
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] zigzag confidence interval in a plot

2013-05-17 Thread Peter Ehlers
th cases kind of zigzags. What can it be the reason? thank you! Sort your dataframe by x-values (CHAOsep12RNA). 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] linear model coefficients by year and industry, fitted values, residuals, panel data

2013-04-04 Thread Peter Ehlers
cília 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. Pe

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

2013-04-03 Thread Peter Ehlers
e OP: Install package sos 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

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

2013-04-03 Thread Peter Ehlers
tually 'coefficients'. 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

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

2013-04-03 Thread Peter Ehlers
t doesn't 'reverse' the order of the new variables.] Suggestion 3: Use the 'data=' argument in the plot: boxplot(residual ~ firm, data = newdata) Peter Ehlers On Wed, Apr 3, 2013 at 3:38 AM, Cecilia Carmo wrote: Hi R-helpers, My real data is a panel (unba

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 Vis

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

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
27;s indeed the set of names, as returned by the levels() function. Peter Ehlers On Mon, Apr 1, 2013 at 2:58 PM, Bert Gunter mailto:gunter.ber...@gene.com>> wrote: Yup. Note also: > as.character.factor function (x, ...) levels(x)[x] But of course this is OK, si

Re: [R] expression

2013-04-01 Thread Peter Ehlers
tter? titt <- bquote("R con ventanas de " ~ .(n) ~ italic(datos)) 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

Re: [R] Console display "buffer size"

2013-04-01 Thread Peter Ehlers
ll the way back to the very first row of Chunk 1? (The size-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. Pet

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 [[alternativ

Re: [R] Plotting histogram of RT data

2013-03-31 Thread Peter Ehlers
frame, then the first thing 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 http

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

Re: [R] A question on function return

2013-03-22 Thread Peter Ehlers
ctor(s) as the function return. Can somebody help me 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.,

Re: [R] Cumulative Frequency Graph

2013-03-19 Thread Peter Ehlers
help page! ?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 wrote: Hello, Try setting the argument xaxt (x axis type) to "n" (no x axis) and then use ?axis. plot

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

2013-03-19 Thread Peter Ehlers
Error in .overlayList(x, fun = 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-hel

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] nlrob and robust nonlinear regression with upper and/or lower bounds on parameters

2013-03-15 Thread Peter Ehlers
using the exp(log(coef)) construct. See argument 'lrc' in ?SSasymp for example. Introducing 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-he

Re: [R] Error message in vars package

2013-03-14 Thread Peter Ehlers
h_2.2-9zoo_1.7-9 MASS_7.3-23 loaded via a namespace (and not attached): [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 postin

Re: [R] Determining maximum hourly slope per day

2013-03-13 Thread Peter Ehlers
slope <- rep(NA, 72) for(i in 6:72) { slope[i] <- coef(lm(temp ~ time, data = d, subset = (i-5):i))[2] } maxslope <- max(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

Re: [R] expression exponent labeling

2013-03-13 Thread Peter Ehlers
y, 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 axi

Re: [R] Stretch the y axis in levelplot

2013-03-12 Thread Peter Ehlers
this is what you want, but you 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

Re: [R] Troubleshooting code

2013-03-12 Thread Peter Ehlers
neys. I thought they just 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] funtion equivalent of jitter to move figures on device

2013-03-12 Thread Peter Ehlers
teractive placement of figures, 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/postin

Re: [R] Constrain slope in segmented package

2013-03-12 Thread Peter Ehlers
: use ?update which will take you to a link 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-

Re: [R] Troubleshooting code

2013-03-12 Thread Peter Ehlers
Your code is not reproducible and you're posting in HTML. Please give at least a cursory look at the Posting Guide. [... rest of code sample snipped ...] Peter Ehlers __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r

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

2013-03-11 Thread Peter Ehlers
order is to have the first 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

Re: [R] plot pch

2013-03-11 Thread Peter Ehlers
Using Rui's dataframe 'dat' 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.

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] 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? Pe

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

2013-03-09 Thread Peter Ehlers
s that R does not have a 'date' type, so: typeof(d) #[1] "double" And the for-loop results follow. 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
names.col? Error in phy$node.label[which(newNb > 0) - Ntip] : only 0's may be mixed 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(-

Re: [R] Inverse function using FDA

2013-03-06 Thread Peter Ehlers
sing this package 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

Re: [R] Troubles with labeling x axis

2013-03-06 Thread Peter Ehlers
da", ylab= "Opazovane vrednosti", type='l', col='red') axis(side=1, 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 __

Re: [R] Wilcox-Off?

2013-03-05 Thread Peter Ehlers
x27;s down as the author of pwilcox. 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
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 wrote: I never saw the "original note" nor its resubmission. Nor could I find it in the R-help archiv

Re: [R] SAS and R complement each other

2013-03-04 Thread Peter Ehlers
On 2013-03-04 12:04, Ista Zahn wrote: On Mon, Mar 4, 2013 at 2:57 PM, Rolf Turner wrote: I never saw the "original note" nor its resubmission. Nor could I find it in the R-help archives. Is it just me? No, same here. Think Nabble!!! (where there are often waits for approv

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

Re: [R] Expressions in lattice conditional variables

2013-03-02 Thread Peter Ehlers
d explore using the factor.levels argument to strip.default(). I hope 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]

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] solving x in a polynomial function

2013-03-01 Thread Peter Ehlers
Re(r[is.zero(Im(r))]) + } r <- 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

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

2013-02-28 Thread Peter Ehlers
ies)[panel.number()] panel.dotplot(...) panel.rect(xleft, ybottom, xright, ytop, fill = "bisque") panel.text(x = (xleft + xright) / 2, y = (ybottom + ytop) / 2, labels = lab) }) Peter Ehlers __ R-h

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

2013-02-25 Thread Peter Ehlers
I would just add a sufficient number of spaces, obtained by trial and error, to each label. On the other hand, why not use lattice's built-in facility to put your labels in the top strips, using the factor.levels argument. But perhaps your real use is more involved than the example. Peter Ehle

Re: [R] Parallel computation in R

2013-02-25 Thread Peter Ehlers
y, get the package off the shelf and put 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-he

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

2013-02-24 Thread Peter Ehlers
elp page a bit too hastily. Could someone please tell me how 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 postin

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

2013-02-24 Thread Peter Ehlers
ot;blue"), c(2, 6) ) bwplot(voice.part ~ 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

Re: [R] levelplot

2012-12-30 Thread Peter Ehlers
of information for colorkey 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
unctions 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

Re: [R] Plot with residuals in mgcv

2012-11-28 Thread Peter Ehlers
x27; in place of 'TRUE' is a bad idea. Actually, it's _always_ a bad idea. 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] GLM Coding Issue

2012-11-27 Thread Peter Ehlers
;s doing that as the first parameter to a `glm` call? Steve: re a matrix response: 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

Re: [R] subsetting - questions

2012-11-23 Thread Peter Ehlers
DOES NOT WORK To see what's wrong, just print the problematic part: -c("X3", "X4", "X5") You can't negate a character vector; you have to have a numeric vector. And !drop_var doesn't work because you need something that ev

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

2012-11-23 Thread Peter Ehlers
ful unless 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 __

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

2012-11-22 Thread Peter Ehlers
font = 1, tck = c(0.8, 0.6, 0.4), 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 guid

Re: [R] create function to solve derivative

2012-11-16 Thread Peter Ehlers
ost" Berend I believe that e-letter is confused by the space-saving 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

Re: [R] lubridate concatenation issue

2012-11-16 Thread Peter Ehlers
ong as his further operations do not depend on the presence of that attribute. Peter Ehlers - Original Message - From: Andre Zege To: "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

Re: [R] lubridate concatenation issue

2012-11-15 Thread Peter Ehlers
utes(c(d)) You'll see that c() removes the 'tzone' 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

Re: [R] Compraring two independent samples

2012-11-15 Thread Peter Ehlers
roblem". If the populations 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 Tea

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

2012-11-15 Thread Peter Ehlers
tatistical 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. _

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

2012-11-14 Thread Peter Ehlers
ot; (to R) your preferred order. But let's 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-tp464948

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
t (pointed to by ?panel.xyplot) (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:

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

2012-10-30 Thread Peter Ehlers
dification 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 wrote: On 2012-10-25 14:42, Bernie Wone wrote: Hi Peter, Thanks for the help. Being a beginner R user with little programming experien

Re: [R] Grid Width in polar.plot

2012-10-26 Thread Peter Ehlers
ngle instance of 'radial.plot' 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-Wid

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 r

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

2012-10-26 Thread Peter Ehlers
is the t(newmat[]) line. I find 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.e

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

2012-10-24 Thread Peter Ehlers
rder = grid.col, col = grid.bg) 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 w

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&#x

Re: [R] Understanding lattice barchart() display

2012-10-23 Thread Peter Ehlers
ate(quant ~ tclass + stream, 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

Re: [R] Selecting n observation

2012-10-11 Thread Peter Ehlers
by(df, 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) Pe

Re: [R] a merge() problem

2012-10-07 Thread Peter Ehlers
On 2012-10-07 14:44, Sam Steingold wrote: * Peter Ehlers [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<---cut h

Re: [R] a merge() problem

2012-10-07 Thread Peter Ehlers
b #3 3 6 A.K. Yes, because 'b' is _not_ a 'by'-name. Peter Ehlers - Original Message - From: Sam Steingold To: r-help@r-project.org Cc: Sent: Sunday, October 7, 2012 11:34 AM Subject: [R] a merge() problem I know it does not look very good - using the same col

Re: [R] a merge() problem

2012-10-07 Thread Peter Ehlers
column name 'a' is duplicated in the result --8<---cut here---end--->8--- why is the suffixes argument ignored? I mean, I expected that the second "a" to be "a.y". The 'suf

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

2012-09-16 Thread Peter Ehlers
ds 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 Ehlers There is some sort of parsing that splits the numeric from the alpha characters even with no spaces intervening, so you need to "protect" the

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

2012-09-16 Thread Peter Ehlers
7 Another way: 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 wo

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

2012-09-04 Thread Peter Ehlers
It may be as simple as typing "mash" instead of "mesh" (note the second letter) 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

Re: [R] boxplot - bclust

2012-09-03 Thread Peter Ehlers
like if (!is.null(x$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 postin

Re: [R] Horizontal grid in background of barplot

2012-09-03 Thread Peter Ehlers
"Ailment", ylab="Percent", legend.text=TRUE, args.legend=list("topright",title="Treatment",bg="white"), add=TRUE) Peter Ehlers __ R-help@r-project.org mailing list https

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 wrote: Hi all, I am using "locator" to select the points from a scatter plot... This is all fine. But the pr

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

2012-08-29 Thread Peter Ehlers
#Example d <- 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, metho

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.

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

2012-08-28 Thread Peter Ehlers
oups = Species, pch = 15:17, col = 2:4, panel = "panel.superpose", panel.groups = function(x,y,...){ panel.xyplot(x,y,...) panel.lmline(x,y,...) }, key = list(corner = c(1,0), text = list(lab = levels(iris[["Species"]])), points = list

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

2012-08-28 Thread Peter Ehlers
describing the subtle behavior you kindly pointed out. Hmmm, it seems to me 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 w

Re: [R] don't print object attributes

2012-08-28 Thread Peter Ehlers
t loses some attributes that you probably 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

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

2012-08-26 Thread Peter Ehlers
main="yadayada") } plotme(survived, threshold=50) 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. Howeve

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

2012-08-25 Thread Peter Ehlers
s myballoonplot and use that in your code. While you're at it, you might remove the attach(survived) statement and use with(survived, myballoonplot()) Peter Ehlers I will appreciate any help that I can get. Thanks, Ravi [[alternative HTML version deleted]]

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,

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

2012-08-24 Thread Peter Ehlers
p a logical rather than numeric flag): vn <- transform(vn, 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 s

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

2012-08-24 Thread Peter Ehlers
no problem getting what I think you expect (i.e. 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? (Sor

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(distanc

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)

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

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,

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

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

2012-08-21 Thread Peter Ehlers
System)) Don't forget the '*' to concatenate 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/posti

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

2012-08-20 Thread Peter Ehlers
Thus 62 is 4.88 ~ 5 units higher than the EV. Now calculate the probability 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,

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

2012-08-20 Thread Peter Ehlers
his is a" ~ test^1 ~ "of the Emergency Broadcast System.")) 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

  1   2   3   4   5   6   7   8   9   10   >