Re: [R] scientific vs. fixed notation in xyplot()

2010-09-27 Thread array chip
Thank you Dr. Sarkar. yscale.components.log10.3 is pretty good choice. John - Original Message From: Deepayan Sarkar To: array chip Cc: Don McKenzie ; Henrique Dallazuanna ; R-help Forum Sent: Mon, September 27, 2010 8:07:15 PM Subject: Re: [R] scientific vs. fixed notation in xypl

[R] Problem with augPred?

2010-09-27 Thread Meissner, Tony (DFW)
I have a dataset, example of the data is shown below: Grouped Data: drain_irr ~ irr | crop Year decades crop irrisystem drain_irrirr 1310 1995-96 1990s Citrusvarious 0.400 9.021 1311 1995-96 1990s Citrus drip 0.541 6.468 1312 1995-96 1990s Citrus overhea

Re: [R] statistic test plot

2010-09-27 Thread Andrew Miles
If you type: class(z.ex) you'll see that your z-test produces an object with a class "htest." Then type: methods("plot") you'll get a list of all the types of objects that the plot() function knows how to make plots for. It doesn't look like plot has a sub- method for an htest object,

Re: [R] max length of a factor variable

2010-09-27 Thread jim holtman
You have provided no information as to what you mean by "my analysis fails". Exactly what error message are you getting, what operation system do you have, how much memory do you have, how much are you using for all the other objects in your address space, etc.. Information like this would hel

Re: [R] scientific vs. fixed notation in xyplot()

2010-09-27 Thread Deepayan Sarkar
On Mon, Sep 27, 2010 at 5:28 PM, array chip wrote: > I found where the problem is with y-axis, the yscale.components.log10 should > be > > yscale.components.log10 <- function(lim, ...) { >    ans <- yscale.components.default(lim = lim, ...) >    tick.at <- logTicks(10^lim,loc=1) >    ans$left$tic

Re: [R] Reshape

2010-09-27 Thread Michael Bedward
I try to remember that timevar defines the wide columns you want and v.names the values in the body of the table - but I always forget next time I need to use reshape :) On 28 September 2010 12:55, Toby Gass wrote: > That does work, thank you.  I didn't understand that the "fame" > column would

[R] statistic test plot

2010-09-27 Thread Kie Kyon Huang
Hi, I am a beginner in R and is trying to plot some dot plot from t test result. I was following the example ## Example from z.test -- requires TeachingDemos package # library(TeachingDemos) # z.ex <- z.test(rnorm(25,100,5),99,5) # z.ex # plot(z.ex) but encounter this error for the last command

Re: [R] max length of a factor variable

2010-09-27 Thread Michael Bedward
Hello Richard, Since no one else has answered yet I'll venture a guess. The following works on my little macbook... x <- as.factor(sapply(letters[1:26], function(x) paste(rep(x, 10), collapse=""))) So each of the 26 factor levels in x has a string representation of 100,000 chars. So I'm *g

[R] rewrite IQR

2010-09-27 Thread John Christie
Hi, Teaching this year I was noticing that there seems to be an odd limitation in the IQR function. It doesn't allow one to set the quantile type. It seems to me an easy thing to fix. The current function is… IQR <- function (x, na.rm = FALSE) diff(quantile(as.numeric(x), c(0.25, 0.75), na

Re: [R] Reshape

2010-09-27 Thread Toby Gass
That does work, thank you. I didn't understand that the "fame" column would be the time varying column. Toby On 28 Sep 2010 at 12:47, Michael Bedward wrote: > Hi Toby, > > I think this should work... > > reshape(dat, v.names=c("weight"), idvar=c("valley", "plot", "trt"), > timevar="fame", di

Re: [R] Reshape

2010-09-27 Thread Michael Bedward
Hi Toby, I think this should work... reshape(dat, v.names=c("weight"), idvar=c("valley", "plot", "trt"), timevar="fame", direction="wide") Michael On 28 September 2010 12:17, Toby Gass wrote: > Hello, helpeRs, > > I've been trying, unsuccessfully, to change a dataframe from long to > wide for

Re: [R] rimage package problems

2010-09-27 Thread Michael Bedward
Hello again Ralf, Using the instructions at that link (minus the bit about copying config files from /usr/share), followed by... install.packages("rimage", type="source") ...seems to have worked for me. I can now load the package and read / display a jpeg file. Michael On 28 September 2010 10

[R] Reshape

2010-09-27 Thread Toby Gass
Hello, helpeRs, I've been trying, unsuccessfully, to change a dataframe from long to wide format using reshape (the original). I would appreciate it if someone could demonstrate the correct syntax. The script below will create a toy example. The new wide data should have a column name for

[R] cochran Q test

2010-09-27 Thread Kohleth Chia
Dear all, I am trying to look for a built in function that performs the cochran Q test. that is, cochranq.test(X) where X is a contingency table (maybe a matrix or data.frame). The output will naturally be the test statisitcs, p-value, etc. A quick search on Google gives me the cochran.test in th

[R] Reshape

2010-09-27 Thread Toby Gass
Hello, helpeRs, I've been trying, unsuccessfully, to change a dataframe from long to wide format using reshape (the original). I would appreciate it if someone could demonstrate the correct syntax. The script below will create a toy example. The new wide data should have a column name for

[R] Problem with augPred?

2010-09-27 Thread Meissner, Tony (DFW)
I have a dataset, example of the data is shown below: Grouped Data: drain_irr ~ irr | crop Year decades crop irrisystem drain_irrirr 1310 1995-96 1990s Citrusvarious 0.400 9.021 1311 1995-96 1990s Citrus drip 0.541 6.468 1312 1995-96 1990s Citrus overhead

Re: [R] Compare two 3d plots

2010-09-27 Thread Chris Harding
Hello, You probably know this already but there are many textbooks on Group theory in statistical processes. Although this book may not help you, the authors may be able to lead you in the right direction: http://www.nd.com/products/nsbook.htm Neural Solutions -- View this message in conte

Re: [R] subtraction based on two groups in a dataframe

2010-09-27 Thread Remko Duursma
Try something like this: dfr <- read.table(textConnection("plate.id well.id Group HYB rlt1 1 P1 A1 Control SKOV3hyb 0.190 2 P1 A2 Control SKOV3hyb 0.210 3 P1 A3 Control SKOV3hyb 0.205 4 P1 A4 Control SKOV3hyb 0.206 5 P

Re: [R] rimage package problems

2010-09-27 Thread Michael Bedward
Hi Ralf, Are you using Mac OSX ? There isn't a binary available for OSX but you can apparently install the package from sources. However, it seems that you have to manually install some system dependencies first: http://www.r-cookbook.com/node/18 I'm going to try it myself shortly. Michael On

Re: [R] scientific vs. fixed notation in xyplot()

2010-09-27 Thread array chip
I found where the problem is with y-axis, the yscale.components.log10 should be yscale.components.log10 <- function(lim, ...) { ans <- yscale.components.default(lim = lim, ...) tick.at <- logTicks(10^lim,loc=1) ans$left$ticks$at <- log(tick.at, 10) ans$left$labels$at <- log(tick.a

Re: [R] Sample size estimation for non-inferiority log-rank and Wilcoxon rank-sum tests

2010-09-27 Thread Peter Dalgaard
On 09/27/2010 08:09 PM, Paul Miller wrote: > Hello Everyone, > > I'm trying to conduct a couple of power analyses and was hoping > someone might be able to help. I want to estimate the sample size > that would be necessary to adequately power a couple of > non-inferiority tests. The first would b

Re: [R] plotting multiple animal tracks against Date/Time

2010-09-27 Thread Struve, Juliane
Hello, thank you very much for replying. The code yields an error message Error in strptime(x, format, tz = tz) : invalid 'x' argument But I can't see what's wrong with it, the Date/Time info is in the third column, format is "%Y-%m-%d %H:%M:%S". There is no time zone info in the data, could

[R] One-sided CUSUM / MOSUM Tests?

2010-09-27 Thread bonda
Dear R-help list members, I have the following question concerning the strucchange()-package: is it possible to get the boundaries for one-sided (upper / lower) CUSUM and MOSUM tests? Thank you in advance. Julia __ R-help@r-project.org mailing l

Re: [R] plotting multiple animal tracks against Date/Time

2010-09-27 Thread Gabor Grothendieck
On Mon, Sep 27, 2010 at 5:38 PM, Struve, Juliane wrote: > Hello, > > thank you very much for replying. The code yields an error message > > Error in strptime(x, format, tz = tz) : invalid 'x' argument > > But I can't see what's wrong with it, the Date/Time info  is in the third > column, format i

Re: [R] Issues with Legend symbols

2010-09-27 Thread Phil Spector
The expression 19:15:21:22 evaluates as follows: 19:15:21:22 [1] 19 20 21 22 Warning messages: 1: In 19:15:21 : numerical expression has 5 elements: only the first used 2: In 19:15:21:22 : The expression 2:2:2:2 evaluates as follows: 2:2:2:2 [1] 2 I'm *guessing* you mean c(19,15,21,22)

[R] Compare two 3d plots

2010-09-27 Thread Ab Hu
Hi, I am still learning and find it very helpful in my research. I have searched before posting this and could not figure out if there is a way to compare matrices the way i am describing below: I have a matrix of 64 cols and 64 rows which mostly has lots of zeros but has other non-zero posit

Re: [R] scientific vs. fixed notation in xyplot()

2010-09-27 Thread array chip
Hi, I found an old thread which refered to 2 examples (Fig 8.4 & Fig 8.5) from Dr. Sarkar's lattice book that address this problem using "xscale.components" and "yscale.components": http://lmdvr.r-forge.r-project.org/figures/figures.html I am able to change the label of x-axis, but still can't

Re: [R] time series

2010-09-27 Thread stephen sefick
I think arima may do the trick. I have not used it, but this is the functionality I have pulled from the ether. On Mon, Sep 27, 2010 at 5:02 PM, Dr. Alireza Zolfaghari wrote: > Hi list, > I have a set of data which I want to use time series analysis in R in order > to forecast the value for futu

Re: [R] Odp: Object Browser

2010-09-27 Thread wxffxw
Thanks very much for your reply, Petr. That's a nice function. Also, I found "gvarbrowser" function in package "gWidgest" is really a good one. It's GUI and yet extendable. library(gWidgets) options(guiToolkit="RGtk2") gvarbrowser(cont=gwindow("Object browser")) I highly recommend to anyone who

[R] time series

2010-09-27 Thread Dr. Alireza Zolfaghari
Hi list, I have a set of data which I want to use time series analysis in R in order to forecast the value for future. I know there are some R functions, but not sure how to use them. Would you please help me if you are familiar with time series in R? I want to get value for Nov 2012 using the foll

[R] Issues with Legend symbols

2010-09-27 Thread beloitstudent
Hello forum! I am currently having trouble getting R to recognize one of my pch characters. Here's what I have: legend(120, 40, c("SAL-arterial", "SAL-portal", "GLP-1-arterial", "GLP-1-portal"), bty="n", col=c("black"), pch=19:15:21:22, pt.bg="white", pt.cex=2:2:2:2, lty=1, lwd=2, text.col="blac

Re: [R] Variation of predictor of linear model

2010-09-27 Thread Yi Du
Thanks Josh. The variance of predictor should be var(beta_0+beta_1*newdata+epsilon). It is actually the variance of dependent variable if we plug the concrete value of independent variable into the model. On Mon, Sep 27, 2010 at 2:09 PM, Joshua Wiley wrote: > Hi, > > Try this: > > # using the

[R] subtraction based on two groups in a dataframe

2010-09-27 Thread 1Rnwb
Hello I have a data set like below: plate.id well.id Group HYB rlt1 1 P1 A1 Control SKOV3hyb 0.190 2 P1 A2 Control SKOV3hyb 0.210 3 P1 A3 Control SKOV3hyb 0.205 4 P1 A4 Control SKOV3hyb 0.206 5 P1 A5 Control SKOV3hyb 0.

Re: [R] calculating mean and s.d. from a two-column table

2010-09-27 Thread Joshua Wiley
Hi, Peter's suggestion is more general, but for just the weighted mean, there is a built in function you can use (I do not know of any basic weighted standard deviation or variance functions). dat <- data.frame(age = 1:5, no = c(21, 31, 9, 12, 6)) weighted.mean(x = dat$age, w = dat$no) Best rega

[R] spplot cuts

2010-09-27 Thread emorway
Hello- After looking through ?spplot, I would expect that I could specify the values of the cuts: "...‘cuts’ number of cuts or the actual cuts to use..." So in the following command, spplot(lzm.krige.dir["var1.pred"], scales=list(draw=TRUE), xlab="Easting",ylab="Northing", cuts=seq(0.0,0.4,

Re: [R] Alphabetical sequence of data along the x-axis in a box plot

2010-09-27 Thread Peter Alspach
Tena koe Eddie One way: eddie <- data.frame(grp=rep(c('small','medium','large','very large'), each=20), wgt=rnorm(80, 100, 10)) with(eddie, plot(grp, wgt)) eddie$grp <- factor(eddie$grp, levels=c('small','medium','large','very large')) with(eddie, plot(grp, wgt)) HTH ... Peter Alspach > -

Re: [R] Alphabetical sequence of data along the x-axis in a box plot

2010-09-27 Thread Joshua Wiley
Hi Eddie, I've been on a role with the iris data, so I figure why stop. Assuming that one variable is a factor, you can easily reverse it, and if you want fine tuned control, then just reorder the levels. Here is an example: dat <- iris boxplot(Sepal.Length ~ Species, data = dat) boxplot(Sepal.L

Re: [R] Variation of predictor of linear model

2010-09-27 Thread Joshua Wiley
Hi, Try this: # using the iris dataset mydat <- iris mymodel <- lm(Sepal.Length ~ Petal.Length + Species, data = mydat) summary(mymodel) newdat <- data.frame(Petal.Length = seq(1, 10, by = .1), Species = factor(rep("virginica", 91))) results <- predict(object = mymodel, newd

Re: [R] plot single part of the country using gadm map

2010-09-27 Thread Paul Murrell
Hi carolina plescia wrote: Dear all, in GADM map there are three levels (nation, province and precinct) for each country of the world but for all of them you are never able to plot only one part of a chosen country. The "Spatial" object you get when you read in the shapefile has convenient s

[R] Alphabetical sequence of data along the x-axis in a box plot

2010-09-27 Thread Hughes, Ed
Hello All, I noticed when I generated some boxplots, the data is presented in alphabetical order along the x-axis (the data in this case was the four quandrants of a sample area (NE,NW, SE, SW) that was my first column of data). Is there a way to have R plot the data in a different order? I i

Re: [R] scientific vs. fixed notation in xyplot()

2010-09-27 Thread Don McKenzie
This is quite elegant (thanks) and brings up a problem I could not solve awhile back, although Dr. Sarkar did his best to help. How do I do the same thing in a panel plot? e.g., toy example temp.df <- data.frame(X=seq(1,100,by=1),Y=seq(1,50.5,by=.5),class=rep (c("A","B"),each=50)) xyplot(Y ~

[R] Variation of predictor of linear model

2010-09-27 Thread Yi Du
Hi folks, I use lm to run regression and I don't know how to predict dependent variable based on the model. I used predict.lm(model, newdata=80), but it gave me warnings. Also, how can I get the variance of dependent variable based on model. Thanks. [[alternative HTML version deleted]]

Re: [R] Sample size estimation for non-inferiority log-rank and Wilcoxon rank-sum tests

2010-09-27 Thread Andrew Miles
I haven't done much with the type of data you're working with, but here is a post that lists a few packages for doing sample size calculations in R. Perhaps one of them will be helpful. https://stat.ethz.ch/pipermail/r-help/2008-February/154223.html Andrew Miles On Sep 27, 2010, at 2:09 PM,

Re: [R] scientific vs. fixed notation in xyplot()

2010-09-27 Thread array chip
Thanks for the suggestion. But my example is just an example, I would prefer to have some generalized solution, like what options(scipen=4) does in general graphics, which usually gave pretty axis labels as well. Any suggestions? Thanks John From: Henrique Da

Re: [R] Percentages and lattice

2010-09-27 Thread Phil Spector
Mark - Here's one way to get the percentages you want. Suppose your data frame is called df: correct = subset(as.data.frame(with(df,table(date,region,correct))), correct=='yes') all = as.data.frame(with(df,table(date,region))) names(all)[3] = 'Total' both = merge(correct,al

[R] Percentages and lattice

2010-09-27 Thread Mark Noworolski
What I'm trying to do is to figure out how to create lattice charts of %right by region, or alternatively, by date from a dataset of observations that looks something like this: date,location,region,correct 2010-09-10,a,r1,yes 2010-09-10,a,r1,yes 2010-09-10,a,r1,no 2010-09-11,a,r1,yes 2010-09-01,b

Re: [R] scientific vs. fixed notation in xyplot()

2010-09-27 Thread Henrique Dallazuanna
Try this: xyplot(1:10~1:10, scales=list(log = T, labels = round(log(1:10), 4))) On Mon, Sep 27, 2010 at 4:10 PM, array chip wrote: > Hi I am using xyplot() to plot on the log scale by using scale=list(log=T) > argument. For example: > > xyplot(1:10~1:10, scales=list(log=T)) > > But the axis l

[R] Sample size estimation for non-inferiority log-rank and Wilcoxon rank-sum tests

2010-09-27 Thread Paul Miller
Hello Everyone,   I'm trying to conduct a couple of power analyses and was hoping someone might be able to help. I want to estimate the sample size that would be necessary to adequately power a couple of non-inferiority tests. The first would be a log-rank test and the second would be a Wilcoxon

[R] scientific vs. fixed notation in xyplot()

2010-09-27 Thread array chip
Hi I am using xyplot() to plot on the log scale by using scale=list(log=T) argument. For example: xyplot(1:10~1:10, scales=list(log=T)) But the axis labels are printed as scientific notation (10^0.0, etc), instead of fixed notation. How can I change that to fixed notation? options(scipen=4) d

Re: [R] margin control in lattice package

2010-09-27 Thread Jonathan Flowers
Hi Peter, Thank you for your thoughtful reply. I am tweaking the setting print settings you suggested. It looks like this is going to solve my problem. Thanks very much for help. Jonathan On Sat, Sep 25, 2010 at 6:00 PM, Peter Ehlers wrote: > On 2010-09-25 8:59, Jonathan Flowers wrote: > >>

[R] Ordered logit with polr won't match SPSS output

2010-09-27 Thread Ben Hunter
I am learning R via a textbook that performs analysis with SPSS and SAS. In trying to reproduce the results for an ordinal logit model, I get very similar point estimates for my cut-off points, but the parameters for the covariate q60 do not match. The estimate for q51 also matches. Is this because

Re: [R] Problem with unlist

2010-09-27 Thread Henrik Bengtsson
On Mon, Sep 27, 2010 at 5:27 AM, Ben Bolker wrote: > Luis Felipe Parra quantil.com.co> writes: > >> >>  Hello, I am trying to unlist a list, which is attached, and I am having the >> problem that when I unlist it the number of elements changes from 5065 to >> 5084 >> >>  > x <- lapply(SumaPluvi,

Re: [R] Regular expressions: offsets of groups

2010-09-27 Thread Gabor Grothendieck
On Mon, Sep 27, 2010 at 1:34 PM, Titus von der Malsburg wrote: > On Mon, Sep 27, 2010 at 7:29 PM, Gabor Grothendieck > wrote: >> Try this zero width negative look behind expression: >> >>> gregexpr("(?!a+)(b+)", "abcdaabbc", perl = TRUE) >> [[1]] >> [1] 2 7 >> attr(,"match.length") >> [1] 1 2 > >

Re: [R] compare two matrices

2010-09-27 Thread Dimitris Rizopoulos
one way is the following: col1 <- c(1,2,3,4,5,6) col2 <- c(6,5,4,3,2,1) m <- cbind(col1, col2) col3 <- c(1,3,2,6) col4 <- c(6,3,5,1) n <- cbind(col3, col4) ind.n <- do.call(paste, c(as.data.frame(n), sep = "\r")) ind.m <- do.call(paste, c(as.data.frame(m), sep = "\r")) ind.n %in% ind.m I hope

Re: [R] stacked area chart

2010-09-27 Thread Dimitri Liakhovitski
I found a solution to my original question (see code below). But I have a question about cosmetics, which I always find very challenging. 1. How can I make all dates appear on the X axis (rotated at 90 degrees vs. horizontal)? 2. How can I create vertical grid lines so that at each date there is a

[R] compare two matrices

2010-09-27 Thread xinxin xx
Hi everyone: I have a kinda easy question but i do not know how to solve that in a simple way. I want to compare the rows of two matrices. col1 <- c(1,2,3,4,5,6) col2 <- c(6,5,4,3,2,1) m <- cbind(col1, col2) col3 <- c(1,3,2,6) col4 <- c(6,3,5,1) n <- cbind(col

Re: [R] Split-split plot design with aov function in R

2010-09-27 Thread Sunny Srivastava
http://www.amazon.com/Statistical-Design-George-Casella/dp/1441926143/ref=sr_1_1?s=gateway&ie=UTF8&qid=1285609902&sr=8-1 Hello Mohd. Yaseen, Please check out the book by Dr. Casella and his website www.stat.ufl.edu/~casella for the relevant R codes. Chapter 5 of this book talks about Split Split P

Re: [R] Split-split plot design with aov function in R

2010-09-27 Thread Muhammad Yaseen
*Hello, I'm new to R and trying to do Split Split Plot Design analysis with aov function in R. Sharing any worked example and suggestion will be highly appreciated. Thanks Regards! * -- * Muhammad Yaseen * [[alternative HTML version deleted]] __

Re: [R] Regular expressions: offsets of groups

2010-09-27 Thread Henrique Dallazuanna
You've tried: gregexpr("b+", "abcdaabbc") On Mon, Sep 27, 2010 at 12:48 PM, Titus von der Malsburg wrote: > Dear list! > > > gregexpr("a+(b+)", "abcdaabbc") > [[1]] > [1] 1 5 > attr(,"match.length") > [1] 2 4 > > What I want is the offsets of the matches for the group (b+), i.e. 2 > and 7, not

Re: [R] finding big matrix size and SVD

2010-09-27 Thread Natasha Asar
I have 500,00 rows in my matrix and i was wondering whether there is any way to get its SVD without breaking it to parts because if R can only read about 1000 columns then to have a rectangular matrix (diagonal i think they are called) I will need to have only 1000 rows I want to know how i can

[R] [R-pkgs] Deducer 0.4-1 and JGR 1.7-2 released

2010-09-27 Thread Ian Fellows
Hi All, I would like to announce the release of Deducer 0.4-1 and JGR 1.7-2 to CRAN. The updates should be propagating through the mirrors over the next few days. On the Deducer side we have a number of nice improvements: 1. A new Text Field Widget for plug-ins is included, which is better suit

[R] [R-pkgs] Bayesian Fractional Polynomials package "bfp" on CRAN

2010-09-27 Thread Daniel Sabanés Bové
Fractional polynomials ("FPs") are an automatic way of fitting non-linear, parametric effects. The R-package mfp implements a frequentist inference approach for FP models. Recently, we have proposed a Bayesian inference approach for normal FP models, which is based on the quasi-default hyper-/

Re: [R] Regular expressions: offsets of groups

2010-09-27 Thread Henrique Dallazuanna
You could do this: gregexpr("ab+", "abcdaabbcbb")[[1]] + 1 On Mon, Sep 27, 2010 at 2:25 PM, Titus von der Malsburg wrote: > On Mon, Sep 27, 2010 at 7:16 PM, Henrique Dallazuanna > wrote: > > You've tried: > > > > gregexpr("b+", "abcdaabbc") > > But this would match the third occurrence of b+ in

Re: [R] Regular expressions: offsets of groups

2010-09-27 Thread Titus von der Malsburg
On Mon, Sep 27, 2010 at 7:29 PM, Gabor Grothendieck wrote: > Try this zero width negative look behind expression: > >> gregexpr("(?!a+)(b+)", "abcdaabbc", perl = TRUE) > [[1]] > [1] 2 7 > attr(,"match.length") > [1] 1 2 Thanks Gabor, but this gives me the same result as gregexpr("b+", "abcdaab

Re: [R] Regular expressions: offsets of groups

2010-09-27 Thread Gabor Grothendieck
On Mon, Sep 27, 2010 at 11:48 AM, Titus von der Malsburg wrote: > Dear list! > >> gregexpr("a+(b+)", "abcdaabbc") > [[1]] > [1] 1 5 > attr(,"match.length") > [1] 2 4 > > What I want is the offsets of the matches for the group (b+), i.e. 2 > and 7, not the offsets of the complete matches.  Is there

Re: [R] Regular expressions: offsets of groups

2010-09-27 Thread Titus von der Malsburg
On Mon, Sep 27, 2010 at 7:16 PM, Henrique Dallazuanna wrote: > You've tried: > > gregexpr("b+", "abcdaabbc") But this would match the third occurrence of b+ in "abcdaabbcbb". But in this example I'm only interested in b+ if it's preceded by a+. Titus _

Re: [R] Regular expressions: offsets of groups

2010-09-27 Thread Titus von der Malsburg
Thank you Jim, but just as the solution that I discussed, your proposal involves deconstructing the pattern and searching several times. I'm looking for a general and efficient solution. Internally, the regexpr engine has all necessary information after one pass through the string. What I need i

Re: [R] Regular expressions: offsets of groups

2010-09-27 Thread jim holtman
try this: > x <- gregexpr("a+(b+)", "abcdaabbcaaacaaab") > justA <- gregexpr("a+", "abcdaabbcaaacaaab") > # find matches in 'x' for 'justA' > indx <- which(justA[[1]] %in% x[[1]]) > # now determine where 'b' starts > justA[[1]][indx] + attr(justA[[1]], 'match.length')[indx] [1] 2 7 17 > On M

Re: [R] calculating mean and s.d. from a two-column table

2010-09-27 Thread Peter Langfelder
On Mon, Sep 27, 2010 at 9:34 AM, Jonas Josefsson wrote: > I have a two-column table as follows where age is in the 1st column and the > number of individuals is in the 2nd. > > age;no > 1;21 > 2;31 > 3;9 > 4;12 > 5;6 You can use the following trick: x = rep(age, no) This repeats age[1] no[1]-ti

[R] calculating mean and s.d. from a two-column table

2010-09-27 Thread Jonas Josefsson
I have a two-column table as follows where age is in the 1st column and the number of individuals is in the 2nd. age;no 1;21 2;31 3;9 4;12 5;6 Can I use mean() and sd() to calculate the mean and standard deviation from this or do I have to manually multiplicate 21*1+31*2 etc. / N? _

Re: [R] pairs and mfrow

2010-09-27 Thread Greg Snow
Why do you want 2 pairs plots on the same device? There may be a better approach to what you want to do. You could use splom from the lattice package along with the print.trellis function to put 2 on the same page. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthca

Re: [R] rimage package problems

2010-09-27 Thread Greg Snow
The rimage package appears to have been abandoned. One option is the EBImage package from Bioconductor. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r

Re: [R] bwplot superpose panel.points from another dataframe

2010-09-27 Thread Peter Ehlers
On 2010-09-27 4:54, Christophe Bouffioux wrote: bwplot(v2 ~ v1 | z, data = ex3, layout=c(3,2), pch = "|", par.settings = list( plot.symbol = list(alpha = 1, col = "transparent",cex = 1,pch = 20)), panel = function(x, y){ panel.bwplot(x, y)

Re: [R] make changes in existing vector with the apply function?

2010-09-27 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Jonas Sundberg > Sent: Monday, September 27, 2010 1:43 AM > To: r-help@r-project.org > Subject: [R] make changes in existing vector with the apply function? > > > Hi, I'm trying

Re: [R] Normalizing Vector with Negative Numbers

2010-09-27 Thread Greg Snow
You can use the scale function, just use the minimum instead of the mean and the range instead of the standard deviation. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-proj

Re: [R] Issue increasing DPI on a png output of a plot

2010-09-27 Thread Peter Langfelder
On Mon, Sep 27, 2010 at 8:48 AM, Justin Fincher wrote: > Howdy, >  I have created a set of plots, but I wish to increase the dpi to 300 > (instead of the default 72).  From the documentation, I thought that > the "res" parameter to png should accomplish this, but it appears to > greatly alter the

[R] Regular expressions: offsets of groups

2010-09-27 Thread Titus von der Malsburg
Dear list! > gregexpr("a+(b+)", "abcdaabbc") [[1]] [1] 1 5 attr(,"match.length") [1] 2 4 What I want is the offsets of the matches for the group (b+), i.e. 2 and 7, not the offsets of the complete matches. Is there a way in R to get that? I know about gsubgn and strapply, but they only give me

[R] stacked area chart

2010-09-27 Thread Dimitri Liakhovitski
Dear R-ers! Asking for your help with building the stacked area chart for the following simple data (several variables - with date on the X axis): ### Creating a data set my.data<-data.frame(date=c(20080301,20080402,20080503,20090301,20090402,20090503,20100301,20100402,20100503), x=c(1.1,1.0,1.6,

[R] Issue increasing DPI on a png output of a plot

2010-09-27 Thread Justin Fincher
Howdy, I have created a set of plots, but I wish to increase the dpi to 300 (instead of the default 72). From the documentation, I thought that the "res" parameter to png should accomplish this, but it appears to greatly alter the appearance of my plot. (plot area becomes smaller, plot lines bec

[R] Issue increasing DPI on a png output of a plot

2010-09-27 Thread Justin Fincher
Howdy, I have created a set of plots, but I wish to increase the dpi to 300 (instead of the default 72). From the documentation, I thought that the "res" parameter to png should accomplish this, but it appears to greatly alter the appearance of my plot. (plot area becomes smaller, plot lines bec

Re: [R] hcluster with linkage median

2010-09-27 Thread Peter Langfelder
On Mon, Sep 27, 2010 at 8:22 AM, Kennedy wrote: > > Hi, > > I want to perform a hierarchical clustering using the median as linkage > metric. As I understand it the function hcluster in package amap have this > option but it does not produce the results that I expect. Also, if you have a large(r)

Re: [R] Newbie Correspondence Analysis Question

2010-09-27 Thread Gavin Simpson
On Sun, 2010-09-26 at 09:41 -0700, Vik Rubenfeld wrote: > I'm experienced in statistics, but I am a first-time R user. I would like to > use R for correspondence analysis. I have installed R (Mac OSX). I have used > the package installer to install the CA package. I have run the following > l

Re: [R] hcluster with linkage median

2010-09-27 Thread Peter Langfelder
On Mon, Sep 27, 2010 at 8:22 AM, Kennedy wrote: > > Hi, > > I want to perform a hierarchical clustering using the median as linkage > metric. As I understand it the function hcluster in package amap have this > option but it does not produce the results that I expect. > > In the example below M is

Re: [R] smooth contour lines

2010-09-27 Thread Duncan Murdoch
On 27/09/2010 11:11 AM, Czerminski, Ryszard wrote: Is there an easy way to control smoothness of the contour lines? In the plot I am working on due to the undersampling the contour lines I am getting are jugged, but it is clear "by eye" these should be basically straight lines. Straight lines

[R] hcluster with linkage median

2010-09-27 Thread Kennedy
Hi, I want to perform a hierarchical clustering using the median as linkage metric. As I understand it the function hcluster in package amap have this option but it does not produce the results that I expect. In the example below M is a matrix of similarities that is transformed into a matrix of

[R] smooth contour lines

2010-09-27 Thread Czerminski, Ryszard
Is there an easy way to control smoothness of the contour lines? In the plot I am working on due to the undersampling the contour lines I am getting are jugged, but it is clear "by eye" these should be basically straight lines. In maps package I found smooth.map function, but maybe there is a mor

[R] rimage package problems

2010-09-27 Thread Ralf B
Hi all, I tried to install the rimage in order to get to the function ?read.jpeg. However, I get this error, independent what mirror I choose: install.packages("rimage") --- Please select a CRAN mirror for use in this session --- Warning message: In getDependencies(pkgs, dependencies, available,

Re: [R] Modify the vertex label

2010-09-27 Thread Gábor Csárdi
Hi, set the 'vertex.label.dist' parameter: g <- graph.ring(10) tkplot(g, vertex.label.dist=1, layout=layout.circle) See ?igraph.plotting for details. Best, Gabor On Mon, Sep 27, 2010 at 11:18 AM, anderson nuel wrote: > Dear r-help, > > I create a graph of my baysian network. I use the package

Re: [R] efficient equivalent to read.csv / write.csv

2010-09-27 Thread Gabor Grothendieck
On Mon, Sep 27, 2010 at 7:49 AM, statquant2 wrote: > > thank you very much for this sql package, the thing is that thoses table I > read are loaded into memory once and for all, and then we work with the > data.frames... > Do you think then that this is going to be quicker (as I would have thougth

Re: [R] name ONLY one column

2010-09-27 Thread Ivan Calandra
Hi, I'm not sure it's even possible (and if it is I don't know how, but I'm no expert). But I think it doesn't make much sense to have only one named column. Just give it a vector: vect_names <- c("myname1", "myname2", "myname3") colnames(my_matrix) <- vect_names HTH, Ivan Le 9/27/2010 10:

Re: [R] name ONLY one column

2010-09-27 Thread Pedersen Jon
Hi, It is because the column names do not exist. If you cast the matrix as a data frame your code would work. jon -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Lorenzo Cattarino Sent: 27. september 2010 10:27 To: r-help@r-project.o

Re: [R] name ONLY one column

2010-09-27 Thread Ista Zahn
Hi Lorenzo, The problem is that my_matrix does not have dimnames. See below. my_matrix <- matrix (1:12,ncol=3) str(my_matrix) ## does not have dimnames dimnames(my_matrix) ## dimnames is NULL colnames(my_matrix) <- "myname" # fails because you are trying to alter the value of something that does

[R] pairs and mfrow

2010-09-27 Thread Mike Harwood
Is there an alternative to par(mfrow=c(2,1)) to get stacked scatterplot matrixes generated with "pairs"? I am using version 2.11.1 on Windows XP. The logic I am using follows, and the second "pairs" plot replaces the first plot in the current graphics device, which is not what I expected (or desi

Re: [R] Good documentation about Sweave

2010-09-27 Thread statquant2
Thank you all for those great links, I will look at those. Thanks again Colin -- View this message in context: http://r.789695.n4.nabble.com/Good-documentation-about-Sweave-tp2714326p2715280.html Sent from the R help mailing list archive at Nabble.com. _

[R] bwplot superpose panel.points from another dataframe

2010-09-27 Thread Christophe Bouffioux
Hi everybody, using bwplot for producing panel boxplot with 3 dimensions i want to add a mark on each boxplot representing one individual (on all its dimensions) till now, i didn't succeed getting the desired solution I want as well to keep the median symbols as a line Many thanks for your help c

Re: [R] Basis functions of cubic regression spline in mgcv

2010-09-27 Thread sw283
The functional form is given in chapter 4 of my book: Wood S.N. (2006) Generalized Additive Models: An Introduction with R. Chapman and Hall/CRC Press. (reserve your copy now for christmas) ... but note that by default mgcv reparameterises so that the identifiability constraints on the smoo

Re: [R] efficient equivalent to read.csv / write.csv

2010-09-27 Thread statquant2
thank you very much for this sql package, the thing is that thoses table I read are loaded into memory once and for all, and then we work with the data.frames... Do you think then that this is going to be quicker (as I would have thougth that building the SQL DB from the flat file would already be

[R] max length of a factor variable

2010-09-27 Thread Richard Mott
Hi Is there a maximum length for the character string representing a level of a factor? I have a set of several million variables, each a factor of length 19. Each factor level is a character string which in some cases can be many thousands of characters long. I am trying to find out why my

[R] make changes in existing vector with the apply function?

2010-09-27 Thread Jonas Sundberg
Hi, I'm trying to make some changes in a vector according to some conditions. It takes too long time however with vector length > 10 and I guess a better way would be using the apply function. I cannot sort out how, however.  As a for/if loop: for (i in 1:length(PrH)) { if (is.finite(PrH[i])

[R] name ONLY one column

2010-09-27 Thread Lorenzo Cattarino
Hi R-users I can not change the name of one column only of my matrix. my_matrix <- matrix (1:12,ncol=3) colnames(my_matrix)[1] <- 'myname' Error in dimnames(x) <- dn : length of 'dimnames' [2] not equal to array extent thank you for your help Lorenzo [[alternat

  1   2   >