Re: [R] Number of words in a string

2008-04-09 Thread Hans-Joerg Bibiko
On 10 Apr 2008, at 07:43, Shubha Vishwanath Karanth wrote: > So powerful, the gsub... But I really don’t understand the how the > regular expressions like " *\\S+$", need to be used and how to make > best use of it... Any article/material/links that I can go through? A good starting point is:

[R] legend placement

2008-04-09 Thread Ng Stanley
Hi, I am plotting 5 charts using p <- par(mfrow = c(3, 2), how can I place my legend in the last region ? I don't wan to put it into the margin. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mail

Re: [R] I have a 3 by 2 plots per page. How do I specify a title at the top centre of each page ?

2008-04-09 Thread Ng Stanley
Found the solution, p <- par(mfrow = c(3, 2), oma = c(0, 0, 2.1, 0)) title(main = paste("Title is here"), outer = TRUE, cex.main = 1.5, font.main = 4) On Thu, Apr 10, 2008 at 11:20 AM, Ng Stanley <[EMAIL PROTECTED]> wrote: > Hi, > > I have a 3 by 2 plots per page. How do I specify a title at

Re: [R] rgl build warnings and loading error on Linux

2008-04-09 Thread Prof Brian Ripley
>From the 'R Installation and Administration Manual': Note that @env{TMPDIR} will be used to execute @command{configure} scripts when installing packages, so if @code{/tmp} has been mounted as @samp{noexec}, @env{TMPDIR} needs to be set to a directory from which execution is allowed.

[R] Question: ACD?

2008-04-09 Thread Yukihiro yamada
Hello everyone, Is it possible to perform "Autoregressive Conditional Duration" (ACD) in R? I'm a graduate student at U of Oregon and want to use ACD in my research project. Please advise. Best, Yuki __ R-help@r-project.org mailing list https://stat.

Re: [R] rgl build warnings and loading error on Linux

2008-04-09 Thread Liviu Andronic
On Wed, Apr 9, 2008 at 9:30 PM, Prof Brian Ripley <[EMAIL PROTECTED]> wrote: > I've never seen that. Is there something unusual about the filesystem so > it does not recognize rgl/configure is executable? (We've seen that on SMB > filesystems with the wrong mount options.) > In /etc/fstab, I ha

Re: [R] Number of words in a string

2008-04-09 Thread Shubha Vishwanath Karanth
So powerful, the gsub... But I really don’t understand the how the regular expressions like " *\\S+$", need to be used and how to make best use of it... Any article/material/links that I can go through? BR, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalo

Re: [R] How to create a legend without plot, and to use scientific notation for axes label ?

2008-04-09 Thread Hans-Jörg Bibiko
On 10.04.2008, at 05:18, Ng Stanley wrote: > Also, is there any way to specify scientific notation for axes label ? Scientific notation à la 3E-4 is set by default. Or did you mean engineering notation? Maybe this could help: http://wiki.r-project.org/rwiki/doku.php?id=tips:data- strings:forma

[R] Huber-white cluster s.e. after optim?

2008-04-09 Thread Peter Muhlberger
Hi Bill: Thanks for the reply! As you've no doubt guessed, I'm not a statistician (I'm a social scientist). I hadn't given thought to modeling the cluster-based covariance explicitly--interesting possibility. My responses are drawn from some 60 discussion groups, and a critic of my current

[R] Fit a nonlinear regression model with power exponentially distributed errors

2008-04-09 Thread Yan (Daniel) Zhao
How to fit a nonlinear regression model with power exponentially distributed errors? I know gnlm has a function gnlr3 that could work, but I would be grateful if example R code is provided. Daniel [[alternative HTML version deleted]] __ R-help@

Re: [R] simple intro to cluster analysis using R

2008-04-09 Thread William Revelle
At 2:00 AM +0300 4/10/08, Donatas G. wrote: >I am looking for simple introduction to cluster analysis using R, that would >be understandable to a novice in statistics. Or, could someone perhaps help >me understand how to proceed in my analysis? I am very new to both statistics >and R, but am tryin

Re: [R] loading an updated version of a package during an active R session?

2008-04-09 Thread Prof Brian Ripley
On Wed, 9 Apr 2008, Roger Levy wrote: > I am developing a package and I want to be able to load an updated > version of the package from within an active R session. Suppose, for > example, I have a function f within a package X. In my active R > session, I have already loaded X. Then I change t

[R] I have a 3 by 2 plots per page. How do I specify a title at the top centre of each page ?

2008-04-09 Thread Ng Stanley
Hi, I have a 3 by 2 plots per page. How do I specify a title at the top centre of each page ? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guid

[R] How to create a legend without plot, and to use scientific notation for axes label ?

2008-04-09 Thread Ng Stanley
Hi, I have a 3 by 2 plots per page, and would like to place a legend on the last region. How to do that ? Also, is there any way to specify scientific notation for axes label ? [[alternative HTML version deleted]] __ R-help@r-project.org maili

Re: [R] Huber-white cluster s.e. after optim?

2008-04-09 Thread Charles Annis, P.E.
I concur! Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rolf Turner Sent: Wednesday, April 09, 2008 10:22 PM To: R-help List Subject:

Re: [R] Huber-white cluster s.e. after optim?

2008-04-09 Thread Rolf Turner
On 10/04/2008, at 2:02 PM, <[EMAIL PROTECTED]> wrote: > In many cases a) often looks difficult, but on closer inspection turns > out to be impossible I nominate this for a fortune. cheers, Rolf Turner

Re: [R] Huber-white cluster s.e. after optim?

2008-04-09 Thread Bill.Venables
optim is a general purpose optimiser. You don't reallly use it to 'analyze' data and you cannot get a variance matrix directly from the result, even using vcov. If you ask, it will give you the hessian matrix of the objective function at the optimum value, from which you can get a variance matrix

Re: [R] question about nlminb

2008-04-09 Thread Spencer Graves
Hi, John: I just got the following error right after the attempt to use 'rmvnorm'. Error: could not find function "rmvnorm" I tried 'library(mvtnorm)', but the 'rmvnorm' in that package gave me the following: Error in rmvnorm(1, mean = c(3, -20, -10, 3, 2), sd = c(0.1, 15,

Re: [R] If statements for vectors

2008-04-09 Thread Vincent Goulet
Le mer. 9 avr. à 18:00, Paul Johnson a écrit : > On Wed, Apr 9, 2008 at 4:07 PM, Laura Bonnett <[EMAIL PROTECTED] > > wrote: >> Dear Sirs, >> >> I am using both the Bioconductor adds on (Affy, AffyPLM,...) and the >> 'standard' R-package. >> >> I am trying to select a list of genes which all have

[R] Computing time when calling C functions - why does an extra function call induce such an overhead?

2008-04-09 Thread Søren Højsgaard
Dear list, I am a little puzzled by computing time in connection with calling C functions. With the function mysolve1 given below I solve Ax=B, where the actual matrix operation takes place in mysolve2. Doing this 5000 times takes 3.51 secs. However, if I move the actual matrix inversion part

[R] Huber-white cluster s.e. after optim?

2008-04-09 Thread Peter Muhlberger
I've used optim to analyze some data I have with good results, but need to correct the var-cov matrix for possible effects of clustering of observations (respondents) in small groups (non-independence). Is there any function to adjust the matrix? I heard some time ago that the vcovHC function wou

[R] LSODA not accurate when RK4 is; what's going on?

2008-04-09 Thread John Tillinghast
I'm solving the differential equation dy/dx = xy-1 with y(0) = sqrt(pi/2). This can be used in computing the tail of the normal distribution. (The actual solution is y(x) = exp(x^2/2) * Integral_x_inf {exp(-t^2/2) dt} = Integral_0_inf {exp (-xt - t^2/2) dt}. For large x, y ~ 1/x, starting around x~

[R] simple intro to cluster analysis using R

2008-04-09 Thread Donatas G.
I am looking for simple introduction to cluster analysis using R, that would be understandable to a novice in statistics. Or, could someone perhaps help me understand how to proceed in my analysis? I am very new to both statistics and R, but am trying hard to avoid having to use SPSS as everyone

[R] loading an updated version of a package during an active R session?

2008-04-09 Thread Roger Levy
I am developing a package and I want to be able to load an updated version of the package from within an active R session. Suppose, for example, I have a function f within a package X. In my active R session, I have already loaded X. Then I change the R source code of f within X and rebuild

[R] Endogenous variables in ordinal logistic (or probit) regression

2008-04-09 Thread Paul Johnson
A student brought this question to me and I can't find any articles or examples that are directly on point. Suppose there are 2 ordinal logistic regression models, and one wants to set them into a simultaneous equation framework. Y1 might be a 4 category scale about how much the respondent likes

Re: [R] If statements for vectors

2008-04-09 Thread Paul Johnson
On Wed, Apr 9, 2008 at 4:07 PM, Laura Bonnett <[EMAIL PROTECTED]> wrote: > Dear Sirs, > > I am using both the Bioconductor adds on (Affy, AffyPLM,...) and the > 'standard' R-package. > > I am trying to select a list of genes which all have expression values below > a certain threshold. > I hav

Re: [R] Number of words in a string

2008-04-09 Thread Charilaos Skiadas
On Apr 9, 2008, at 1:27 PM, Hans-Jörg Bibiko wrote: > > On 09.04.2008, at 17:46, Shubha Vishwanath Karanth wrote: >> To put it simple, >> >> C=c("My Dog", "Its really good", "Beautiful") >> >> Now, >> SOMEFUNCTION(C) should give: c("My", "Its really", "") > > SOMEFUNCTION <- function(x) gsub(" *\

Re: [R] vectorized way to combine levels of a factor

2008-04-09 Thread Abhijit Dasgupta
For your first problem, you can probably do it in 2 statements: V3 = ifelse(V2==A,V2,V3) V3 = ifelse(V2==B|V2==C,D,V3) If you want to split V1 into (0,a],(a,b],(b,c],(c,1], you can do, quite simply V1.factor = cut(V1, c(0,a,b,c,1)) Abhijit On Wed, 9 Apr 2008 13:58:17 -0700 Chang Liu <[EMAIL PROTE

[R] If statements for vectors

2008-04-09 Thread Laura Bonnett
Dear Sirs, I am using both the Bioconductor adds on (Affy, AffyPLM,...) and the 'standard' R-package. I am trying to select a list of genes which all have expression values below a certain threshold. I have done this by creating a vector which has 0s where the expression is greater than the thres

[R] vectorized way to combine levels of a factor

2008-04-09 Thread Chang Liu
Hi Gurus: If I have a large dataset of the form of: > x <- data.frame(V1 = runif(10), V2 = sample(c('A','B','C'),10,T)) > x > V1 V21 0.2691580 A2 0.8711267 B3 0.2674728 C4 0.3278876 A5 > 0.1809152 A6 0.2499651 C7 0.9155174 A8 0.8004974 B9 0.7885516 A10 > 0.9301630

Re: [R] GLM fitting in R and Statistica

2008-04-09 Thread Greg Snow
Can you get fitted values out of Statistica? If the 2 models are equivalent, just using different encodings of the categorical variables, then the fitted values will be the same (within roundoff error) even though the coefficient estimates may differ. So as a first step you should compare the fit

Re: [R] permutation/randomization

2008-04-09 Thread Greg Snow
You can randomize the order (permute) of a single column with something like: > x <- cbind( x=1:10, y=101:110, z=201:210 ) > rownames(x) <- letters[1:10] > new.x <- x > new.x[,1] <- sample(new.x[,1]) > new.x x y z a 8 101 201 b 10 102 202 c 5 103 203 d 9 104 204 e 3 105 205 f 1 106 206

Re: [R] read table not reading lines containing single quotes

2008-04-09 Thread Philipp Pagel
On Wed, Apr 09, 2008 at 04:09:57PM -0400, Vidhu Choudhary wrote: > kegg<-read.table("c:/IDs.tab",header =TRUE,quote= "'", sep="\t") * > *It doesnot read from Alzheimer's disease. Due the single qoutes in it. You have almost given the answer yourself: you are declaring the single quote to be a q

Re: [R] permutation/randomization

2008-04-09 Thread Philipp Pagel
On Wed, Apr 09, 2008 at 11:08:28AM -0700, Grant Gillis wrote: > I would like to randomize data within columns. I think the following line does what you want (minus preserving the row labels): apply(data, 2, sample) Maybe someone smarter than me knows how to preserve the row names. I would proba

Re: [R] permutation/randomization

2008-04-09 Thread Tobias Verbeke
Grant Gillis wrote: > Hello, > > I have what I suspect might be an easy problem but I am new to R and > stumped. I have a data set that looks something like this > > b<-c(2,3,4,5,6,7,8,9) > x<-c(2,3,4,5,6,7,8,9) > y<-c(9,8,7,6,5,4,3,2) > z<-c(9,8,7,6,1,2,3,4) > data<-cbind(x,y,z) > row.names(dat

[R] read table not reading lines containing single quotes

2008-04-09 Thread Vidhu Choudhary
Hi, * I am using read.table command as follow kegg<-read.table("c:/IDs.tab",header =TRUE,quote= "'", sep="\t") * Fragment of file is as follow: ID Pathway 04916Melanogenesis 04920Adipocytokine signaling pathway 04930Type II diabetes mellitus 04940Type I diabetes mellitus 0

Re: [R] GLM fitting in R and Statistica

2008-04-09 Thread Ingmar Visser
> I have a problem concerning discrepances between R (which I use) and > Statistica (which uses my supervisor). --- can this be submitted as a fortune? any other programs around that use supervisors, it's always good to have a couple of those around ingmar

Re: [R] apply lm() for all the columns of a matrix

2008-04-09 Thread Greg Snow
It is still not clear what is your response (y) variable and exactly what is your predictor (x) variable(s). If you have a separate vector of length 10 that is the response and you want to regress it with each of the 8 vectors mentioned, then here is one way to do that: > p<-1:80+rnorm(80) > dim(

Re: [R] creating expression with for-loop

2008-04-09 Thread Duncan Murdoch
On 4/9/2008 3:22 PM, Thomas Hoffmann wrote: > Dear listmembers > > I would like to create an expression that looks like > > labl = expression(10^1,10^2,10^3,10^4,10^5) > > using a for-loop. However > > for (i in 1:5){ labl[i]=expression(10^i) } > > does not do the right thing. Does anybody kno

Re: [R] Skipping specified rows in scan or read.table

2008-04-09 Thread Prof Brian Ripley
On Wed, 9 Apr 2008, Ravi Varadhan wrote: > Hi, > > > > I have a data file, certain lines of which are character fields. I would > like to skip these rows, and read the data file as a numeric data frame. I > know that I can skip lines at the beginning with read.table and scan, but is > there a wa

Re: [R] rgl build warnings and loading error on Linux

2008-04-09 Thread Prof Brian Ripley
Right, that shows that the rgl configure script is not being run and no linking is being done to any GL libraries. I've never seen that. Is there something unusual about the filesystem so it does not recognize rgl/configure is executable? (We've seen that on SMB filesystems with the wrong mou

Re: [R] Changing default plot behaviour

2008-04-09 Thread Thompson, David (MNR)
Thank you all for your help. I successfully used Richard's suggestion (much like John's) and continued with my work, neglecting to respond to the list. Sorry about that. Thanx again, DaveT. >-Original Message- >From: John Kane [mailto:[EMAIL PROTECTED] >Sent: April 9, 2008 03:16 PM >To: T

[R] creating expression with for-loop

2008-04-09 Thread Thomas Hoffmann
Dear listmembers I would like to create an expression that looks like labl = expression(10^1,10^2,10^3,10^4,10^5) using a for-loop. However for (i in 1:5){ labl[i]=expression(10^i) } does not do the right thing. Does anybody knows help? Thanks Thomas

Re: [R] Changing default plot behaviour

2008-04-09 Thread John Kane
This may be a bit simple minded but why not change those commmands into a single function something like this and run it rather than the actual plot command? myfunction <- function(a) { plot(a, axes=FALSE) axis(1, tcl=0.5) axis(2, tcl=0.5) axis(3, tcl=0.5, labels=FALSE) axis(4, tcl=0.5, labels

Re: [R] permutation test assumption?

2008-04-09 Thread Greg Snow
A few comments, My first impression on reading that abstract was that it was complete nonsense. After thinking a bit about it and skimming the full article I decided that it was nonsense, but nonsense that is important to research and discuss (and therefore the paper is useful). Why is it non

Re: [R] rgl build warnings and loading error on Linux

2008-04-09 Thread Charles C. Berry
On Wed, 9 Apr 2008, Liviu Andronic wrote: > Dear R users, > > This is a follow-up of a recent discussion on building rgl on Gentoo > Linux. Please read bellow. > > On Tue, Mar 18, 2008 at 7:24 PM, Charles C. Berry <[EMAIL PROTECTED]> wrote: >> Below substitute 'nvidia-drivers' or whatever you use

Re: [R] diagonally fill a rectangle with color gradient

2008-04-09 Thread Greg Snow
Here are a couple of ways using base graphics: > library(TeachingDemos) > x <- y <- seq(0,1,length.out=100) > tmp <- expand.grid(x=x,y=y) > z <- matrix( tmp$x + tmp$y, 100 ) > > plot( 0:1, 0:1, type='n', xlab='x', ylab='y' ) > subplot( image(x,y,z, col=topo.colors(100), axes=FALSE, xlab='', ylab='

Re: [R] Skipping specified rows in scan or read.table

2008-04-09 Thread jim holtman
Read the file in as lines of text (readLines), 'grep' through the character vector and delete the lines you want and then use: read.table(textConntection(yourvector)) to read the corrected data in. On 4/9/08, Ravi Varadhan <[EMAIL PROTECTED]> wrote: > Hi, > > > > I have a data file, certain line

Re: [R] rgl build warnings and loading error on Linux

2008-04-09 Thread Liviu Andronic
Dear Duncan and Brian, thank you for the quick replies. Please see bellow. On Wed, Apr 9, 2008 at 6:11 PM, Prof Brian Ripley <[EMAIL PROTECTED]> wrote: > We'll need to see the output from install.packages("rgl") to have much idea: > localhost liviu # R CMD INSTALL "/home/liviu/inst/dwn_R/rgl_0.77

[R] Skipping specified rows in scan or read.table

2008-04-09 Thread Ravi Varadhan
Hi, I have a data file, certain lines of which are character fields. I would like to skip these rows, and read the data file as a numeric data frame. I know that I can skip lines at the beginning with read.table and scan, but is there a way to skip a specified sequence of lines (e.g., 1, 2, 1

Re: [R] Changing default plot behaviour

2008-04-09 Thread hadley wickham
On Wed, Apr 9, 2008 at 10:12 AM, Thompson, David (MNR) <[EMAIL PROTECTED]> wrote: > Hello, > > How would I make the default behaviour of my plots produce output such > as the following (i.e. tick marks inside on all axes, labels only on two > (arbitrary?) sides) without needing the five addition

[R] How do I get the parameters out of e1071's svm?

2008-04-09 Thread Martin C. Martin
Hi all, I'm trying to get a simple, linear decision surface from e1071's svm. I've run it like this: svm(as.factor(slow) ~ SLICE.3 + PSGR.7 + SOLUTIONS.6 + DR.10, y, kernel='linear', cost=1e6, class.weights=c('FALSE'=1, 'TRUE'=10)) According to the docs, kernel='linear' has a kernel u'v. Sinc

[R] GLM fitting in R and Statistica

2008-04-09 Thread Agnieszka Kloch
Hi, I have a problem concerning discrepances between R (which I use) and Statistica (which uses my supervisor). I can't say what is the origin of these differences but unfortunately my supervisor doesn't know that either. Our response variable is number (or presence/absence) of parasites in ro

[R] permutation/randomization

2008-04-09 Thread Grant Gillis
Hello, I have what I suspect might be an easy problem but I am new to R and stumped. I have a data set that looks something like this b<-c(2,3,4,5,6,7,8,9) x<-c(2,3,4,5,6,7,8,9) y<-c(9,8,7,6,5,4,3,2) z<-c(9,8,7,6,1,2,3,4) data<-cbind(x,y,z) row.names(data)<-c('a','b','c','d','e','f','g','h') wh

Re: [R] Adding text to strip in xYplot

2008-04-09 Thread John Poulsen
Hello Christoph, Oops, I see that the factor.levels function is in the help menu for strip.default. I had tried it, but not specified it correctly. Thanks again for you help, John Christoph Meyer wrote: > Hi John, > > a solution to your problem would be using strip.custom like this: > > ...

Re: [R] Number of words in a string

2008-04-09 Thread Hans-Jörg Bibiko
On 09.04.2008, at 17:46, Shubha Vishwanath Karanth wrote: > To put it simple, > > C=c("My Dog", "Its really good", "Beautiful") > > Now, > SOMEFUNCTION(C) should give: c("My", "Its really", "") SOMEFUNCTION <- function(x) gsub(" *\\w+$", "", x) But be aware that this won't work for instance for

[R] How to estimate a hazard ratio using an external hazard function

2008-04-09 Thread Montse Rué
Hi, I would like to compare the hazard functions of two samples using the Cox proportional hazards model. For sample 1 I have individual time-to- event data. For sample 2 I don't have individual data, but grouped data that allows to obtain a hazard function. I am wondering if there is an R f

Re: [R] Adding text to strip in xYplot

2008-04-09 Thread Christoph Meyer
Hi John, a solution to your problem would be using strip.custom like this: ... with(dat,xYplot(Cbind(ycomb, y.up, y.low)~x1|factor(grp), data=dat,type="l", method="bands", scales=list(y=list(relation="free"),x=list(alternating=c(1,1,1))), ylim=list(c(0,1200),c(0,1)), strip=strip.custom(fact

Re: [R] rgl build warnings and loading error on Linux

2008-04-09 Thread Prof Brian Ripley
We'll need to see the output from install.packages("rgl") to have much idea: R CMD ldd /usr/lib/R/library/rgl/libs/rgl.so would also be informative. On Wed, 9 Apr 2008, Duncan Murdoch wrote: > On 4/9/2008 10:53 AM, Liviu Andronic wrote: >> Dear R users, >> >> This is a follow-up of a recent di

Re: [R] Number of words in a string

2008-04-09 Thread Gabor Grothendieck
Actually the last example was all but the first word, not all but the last word. All but the last word is: > sapply(strapply(C, "\\w+"), head, -1) [[1]] [1] "My" [[2]] [1] "Its""really" [[3]] character(0) On Wed, Apr 9, 2008 at 11:56 AM, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > See

Re: [R] R beginner - how to apply function to more than one matrix / data.array / ...

2008-04-09 Thread Gabor Csardi
Yes, it is exactly 'apply', and its friends. E.g. you can collect the objects into a list and then do sapply(mylist, is.matrix) G. On Wed, Apr 09, 2008 at 11:52:08AM -0400, Mon Mag wrote: > I would like to apply a simple function, like > is.matrix > to more than one data.frame > How can I call

Re: [R] Number of words in a string

2008-04-09 Thread Gabor Grothendieck
See strapply in the gsubfn package and the gsubfn home page at gsubfn.googlecode.com. Here we extract the words, the last word and all but the last word: > library(gsubfn) > strapply(C, "\\w+") [[1]] [1] "My" "Dog" [[2]] [1] "Its""really" "good" [[3]] [1] "Beautiful" > sapply(strapply(C, "

Re: [R] Number of words in a string

2008-04-09 Thread Hans-Joerg Bibiko
On 9 Apr 2008, at 17:44, Shubha Vishwanath Karanth wrote: > Got all the answers using ?strsplit... Is there any way without > using string split?... More specifically... How can I just extract > the last word in all the strings without using ?strsplit ? Oops, sorry. gsub(" *\w+$", "", C) sh

Re: [R] Number of words in a string

2008-04-09 Thread Shubha Vishwanath Karanth
To put it simple, C=c("My Dog", "Its really good", "Beautiful") Now, SOMEFUNCTION(C) should give: c("My", "Its really", "") Thanks, Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -

[R] R beginner - how to apply function to more than one matrix / data.array / ...

2008-04-09 Thread Mon Mag
I would like to apply a simple function, like is.matrix to more than one data.frame How can I call on more than one data.frame? (are there any wildcards, etc?) I am a true beginner and have tried to look this up in help files, but cannot figure it out. Thank you. [[alternative HTML versi

Re: [R] Number of words in a string

2008-04-09 Thread Hans-Joerg Bibiko
Something like that? gsub(" {1,}\w+$", "", C) __ 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] Number of words in a string

2008-04-09 Thread Shubha Vishwanath Karanth
Got all the answers using ?strsplit... Is there any way without using string split?... More specifically... How can I just extract the last word in all the strings without using ?strsplit ? Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London *

Re: [R] Number of words in a string

2008-04-09 Thread Christos Hatzis
length(unlist(strsplit(C, ' '))) > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Shubha > Vishwanath Karanth > Sent: Wednesday, April 09, 2008 11:21 AM > To: [EMAIL PROTECTED] > Subject: [R] Number of words in a string > > Hi R, > > > > A qui

Re: [R] Number of words in a string

2008-04-09 Thread Shubha Vishwanath Karanth
Exactly...this is what I wanted... Can we also extract/remove the last word of the strings? Example: > C=c("My Dog", "Its really good", "Beautiful") > sapply(strsplit(C, " "), length) [1] 2 3 1 Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * Lond

Re: [R] Number of words in a string

2008-04-09 Thread Hans-Joerg Bibiko
On 9 Apr 2008, at 17:29, Markus Gesmann wrote: > Would this: > > sapply(strsplit(C, " "), length) > > work for? or length(unlist(strsplit(C, " "))) --Hans __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do rea

Re: [R] Number of words in a string

2008-04-09 Thread Shubha Vishwanath Karanth
To put in more general, C=c("My Dog", "Its really good", "Beautiful") And the resultant output should be [1] 2 3 1 ...the number of words Thank you... Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore *

Re: [R] Changing default plot behaviour

2008-04-09 Thread Richard . Cotton
> How would I make the default behaviour of my plots produce output such > as the following (i.e. tick marks inside on all axes, labels only on two > (arbitrary?) sides) without needing the five additional commands each > time? > > plot(1:10, axes=FALSE) > axis(1, tcl=0.5) > axis(2, tcl=0.5) > axi

Re: [R] Number of words in a string

2008-04-09 Thread Markus Gesmann
Would this: sapply(strsplit(C, " "), length) work for? Markus Gesmann │Associate Director│Libero Ventures Ltd, One Broadgate, London EC2M 2QS tel: +44 (0)207 826 9080│ dir: +44 (0)207 826 9085│fax: +44 (0)207 826 9090 │www.libero.uk.com A Lehman Brothers Company AUTHORISED AND REGULATED BY

Re: [R] Coefficient of determination for generalized linear models

2008-04-09 Thread eric . e . harper
Asking the question usually makes one think about the workarounds J. I reviewed the pscl source and found the code for pR2. Sourcing the following internal functions allowed me to compute the pseudo R2 measures. pR2Work <- function(llh,llhNull,n){ McFadden <- 1 - llh/llhNu

[R] AnnotationDBI and RSQLite installation problem

2008-04-09 Thread Maya Bercovich
Hi All, I tried to install AnnotationDBI like so: source("http://bioconductor.org/biocLite.R";) biocLite("AnnotationDbi") and got this error: Loading required package: RSQLite Error in dyn.load(file, ...) : unable to load shared library '/RHEL3/local/lib64/R/library/ RSQLite/libs/RSQLite

[R] Proportional Hazard mixture cure model

2008-04-09 Thread Michele Petteni
Dear all, I've been trying to find a package to simulate a proportional hazard mixture cure model. I've had a look at the nltm package and the references seem to include a PHMCM method but the package doesn't seem to. I've also had a look at the package semicure (as per this thread http://t

[R] Number of words in a string

2008-04-09 Thread Shubha Vishwanath Karanth
Hi R, A quick question: How do we find the number of words in a string? Example: C="Have a nice day" And the number of words should be 4. any built in function or?... Thanks, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo *

[R] mgcv::predict.gam lpmatrix for prediction outside of R

2008-04-09 Thread David Katz
This is in regards to the suggested use of type="lpmatrix" in the documentation for mgcv::predict.gam. Could one not get the same result more simply by using type="terms" and interpolating each term directly? What is the advantage of the lpmatrix approach for prediction outside R? Thanks. -- View

Re: [R] rgl build warnings and loading error on Linux

2008-04-09 Thread Duncan Murdoch
On 4/9/2008 10:53 AM, Liviu Andronic wrote: > Dear R users, > > This is a follow-up of a recent discussion on building rgl on Gentoo > Linux. Please read bellow. > > On Tue, Mar 18, 2008 at 7:24 PM, Charles C. Berry <[EMAIL PROTECTED]> wrote: >> Below substitute 'nvidia-drivers' or whatever you

[R] Changing default plot behaviour

2008-04-09 Thread Thompson, David (MNR)
Hello, How would I make the default behaviour of my plots produce output such as the following (i.e. tick marks inside on all axes, labels only on two (arbitrary?) sides) without needing the five additional commands each time? plot(1:10, axes=FALSE) axis(1, tcl=0.5) axis(2, tcl=0.5) axis(3, tcl=0

Re: [R] apply lm() for all the columns of a matrix

2008-04-09 Thread Costas Douvis
Here's a simplified example p<-1:80+rnorm(80) dim(p)<-c(2,2,2,10) We could say that the 4-d array p consists of 2*2*2 = 8 vectors of length 10. So what I'm asking for is a fast way to perform a linear fit to all those vectors. I'm sorry if I'm causing you to have a headache with all those dimens

Re: [R] rgl build warnings and loading error on Linux

2008-04-09 Thread Liviu Andronic
Dear R users, This is a follow-up of a recent discussion on building rgl on Gentoo Linux. Please read bellow. On Tue, Mar 18, 2008 at 7:24 PM, Charles C. Berry <[EMAIL PROTECTED]> wrote: > Below substitute 'nvidia-drivers' or whatever you use for > > > emerge -D mesa > revdep-r

[R] Coefficient of determination for generalized linear models

2008-04-09 Thread eric . e . harper
Thanks in advance for your kind attention. I am using R to fit empirical data to generalized linear models. AIC (Akaike information criterion) is a measure of the goodness of fit returned by calls to glm(). I would also like to calculate the coefficient of determination R2, altho

Re: [R] Replace values according to conditions

2008-04-09 Thread Suhaila Zainudin
Thanks for all the reply. I solved the task using apply(as suggested by Hans). The tips on S-Poetry and ?Logic are very handy as well. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinf

Re: [R] apply lm() for all the columns of a matrix

2008-04-09 Thread Dimitris Rizopoulos
Well, could you provide a little bit more information regarding what you are trying to do (e.g., reproducible example). Best, Dimitris Dimitris Rizopoulos Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/

Re: [R] apply lm() for all the columns of a matrix

2008-04-09 Thread Costas Douvis
Thank you all very much for replying. Of course you are absolutely right but unfortunately I really deal with the case of a 4-d matrix so what you said does not apply. I should have specified but being a new R user I hadn't realized the difference between a matrix and an array. So please tell me i

Re: [R] How to add background color of a 2D chart by quadrant

2008-04-09 Thread Mike Prager
"tom soyer" <[EMAIL PROTECTED]> wrote: > I have a 2D chart that is divided into four quadrants, I, II, III, IV: > > plot(1:10,ylim=c(0,10),xlim=c(0,10),type="n") > abline(v=5,h=5) > text(x=c(7.5,7.5,2.5,2.5),y=c(2.5,7.5,7.5,2.5),labels=c("I","II","III","IV")) > I would like to fill each quadrant

Re: [R] Weibull maximum likelihood estimates for censored data

2008-04-09 Thread Terry Therneau
> I have a matrix with data and a column indicating whether it is censored > or not. Is there a way to apply weibull and exponential maximum > likelihood estimation directly on the censored data, like in the paper: > Backtesting Value-at-Risk: A Duration-Based Approach, P Chrisoffersen > and D Pel

[R] Odp: Vectorize tapply(...,cumsum) output

2008-04-09 Thread Petr PIKAL
Hi it is a work for do.call try Nc<-do.call(c,N) xyplot(Nc ~ t,groups=i,type="o",key=simpleKey(as.character(1:3),x=0,y=1,lines=T)) Regards Petr [EMAIL PROTECTED] [EMAIL PROTECTED] napsal dne 09.04.2008 14:53:41: > I would like to graph cumulative counts > and use tapply(...,cumsum) to get >

[R] [R-pkgs] energy 1.1-0 with dcov

2008-04-09 Thread Maria Rizzo
Dear R-users, An updated version of the energy package, energy 1.1-0, is now available on CRAN. This version has merged the dcov package (previously available from my personal web page) into energy. New functions include: dcov (distance covariance) dcor (distance correlation) DCOR (four stati

[R] Vectorize tapply(...,cumsum) output

2008-04-09 Thread Gerrit Draisma
I would like to graph cumulative counts and use tapply(...,cumsum) to get the cumulative counts. For instance: library(lattice) t<-rep(1:4,each=3)#time i<-rep(1:3,times=4) #categories n<-rpois(length(t),t) #count xyplot(n ~ t,groups=i, type="o",key=simpleKey(as.charact

Re: [R] fuzzy merge

2008-04-09 Thread Alberto Monteiro
ravi wrote: > > d3<-merge(d1,d2,by.x=time1,by.y=time2) > will work only for exact matching. One possible option is to match > the times for the date and hour times only (by filtering away the > minute data). But this is only a partial solution as I am not > interested in data where the time di

[R] Adding text to strip in xYplot

2008-04-09 Thread John Poulsen
Hello again, I have been trying to add an expression to the strips in xYplot to no avail. For example, in the code below, the text in the strips for each panel is "Anls" and "Plts". However, I would like it to add "Anls km^2" and "Plants km^2" with the exponents raised. I tried resetting the

Re: [R] question about nlminb

2008-04-09 Thread John Pitchard
Hi Spencer, Sorry for not producing code as a worked example. Here's an example: == # setting the seed number set.seed(0) # creating a correlation matrix corr <- diag(5) corr[lower.tri(corr)] <- 0.5 corr[upper.tri(corr)] <- 0.5 # Data for the minimisation mat <-

Re: [R] apply lm() for all the columns of a matrix

2008-04-09 Thread Chuck Cleland
On 4/9/2008 6:55 AM, Costas Douvis wrote: > Hi all, > > My question is not really urgent. I can write a loop and solve the > problem. But I know that I'll be in a similar situation many more times so > it would be useful to find out the answer > > Is there a fast way to perform linear fit to all

Re: [R] apply lm() for all the columns of a matrix

2008-04-09 Thread Dimitris Rizopoulos
If you have the same design matrix then you can specify a matrix of responses in lm(), e.g., Y <- matrix(rnorm(100*10), 100, 10) x <- rnorm(100) fit <- lm(Y ~ x) fit summary(fit) I hope it helps. Best, Dimitris Dimitris Rizopoulos Biostatistical Centre School of Public Health Catholic U

Re: [R] fuzzy merge

2008-04-09 Thread jim holtman
Here is one way of doing it. Create a new dataframe with the values, look for the breaks in times between the two sequences and then create a results dataframe: > # convert time to POSIXct > d1$time1 <- as.POSIXct(paste(d1[[1]], d1[[2]])) > d2$time2 <- as.POSIXct(paste(d2[[1]], d2[[2]])) > d1$ID1

[R] apply lm() for all the columns of a matrix

2008-04-09 Thread Costas Douvis
Hi all, My question is not really urgent. I can write a loop and solve the problem. But I know that I'll be in a similar situation many more times so it would be useful to find out the answer Is there a fast way to perform linear fit to all the columns of a matrix? (or in the one dimension of a m

Re: [R] Correlation between two multi-dimensional matrices

2008-04-09 Thread Ben Bolker
Ng Stanley gmail.com> writes: > > Hi, > > Are there any methods for computing the correlation between two > multi-dimensional matrices ? Will transforming the matrices into vectors and > applying pearson be fine ? Any blind spots that I should be aware ? > If they were something like multi-

Re: [R] Mode Vs Class

2008-04-09 Thread Heinz Tuechler
Congratulation Bill for this very clear and useful explanation. Heinz At 14:58 08.04.2008, [EMAIL PROTECTED] wrote: >'mode' is a mutually exclusive classification of objects according to >their basic structure. The 'atomic' modes are numeric, complex, >charcter and logical. Recursive objects ha

  1   2   >