[R] preallocating matrices and rda read-back objects

2008-04-09 Thread Alexy Khrabrov
I've read in Phil Spector's new book that it's a good idea to preallocate a big matrix, like u - matrix(0,nrow,ncol) # (1) Now, I read contents of a huge matrix from a Fortran binary dump. u - readBin(con,what=double,n=nrow*ncol) # (2) If I do (1) and then (2), u is a vector, obviously it's

[R] Correlation between two multi-dimensional matrices

2008-04-09 Thread Ng Stanley
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 ? Thanks Stanley [[alternative HTML version deleted]]

Re: [R] chi-square test

2008-04-09 Thread J Dougherty
On Tuesday 08 April 2008 17:04:16 Roslina Zakaria wrote: Hi R-users, I would like to find the goodness of fit using Chi-suare test for my data below: xobs=observed data, xtwe=predicted data using tweedie, xgam=predicted data using gamma xobs - c(223,46,12,5,7,17) xtwe -

Re: [R] distance matrix as text file - how to import?

2008-04-09 Thread Hans-Joerg Bibiko
On Tue, Apr 8, 2008 at 1:50 PM, Hans-Jörg Bibiko [EMAIL PROTECTED] wrote: I was sent a text file containing a distance matrix à la: 1 2 3 4 5 6 Thanks a lot for your hints. At the end all hints ends up more or less in my stony way to do it. Let me summarize it. The clean way is to

[R] Replace values according to conditions

2008-04-09 Thread Suhaila Zainudin
Greetings R-users, I have the following data called mydata in a data.frame Col1 Col2 Col3 Col4 Col5 1 2 46 7 8 8 73 5 4 4 56 7 I want to replace the data according to the following conditions Condition 1 if data = 3, replace with -1

Re: [R] Replace values according to conditions

2008-04-09 Thread Richard . Cotton
I have the following data called mydata in a data.frame Col1 Col2 Col3 Col4 Col5 1 2 46 7 8 8 73 5 4 4 56 7 I want to replace the data according to the following conditions Condition 1 if data = 3, replace with -1 Condition 2

[R] publish R on gotAPI ?

2008-04-09 Thread Hans-Peter
I recently stumbled across www.gotAPI.com which is a really nice site to lookup infos of many different languages. - Wouldn't it be a good idea to submit a request to add R? -- Regards, Hans-Peter [[alternative HTML version deleted]] __

[R] fuzzy merge

2008-04-09 Thread ravi
Hi, I would like to merge two data frames. It is just that I want the merging to be done with some kind of a fuzzy criterion. Let me explain. My first data frame looks like this : ID1 time1dt 12008-01-02

Re: [R] problem with basic boolean selection in sequence

2008-04-09 Thread Richard . Cotton
I have a surprising problem while selecting values in a sequence created with the seq() function... ... test2-seq(from=0,to=1,by=.1) ... test2==0.3 [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE ... Does anyones has an explanation and a solution ? I suspect that

[R] R: Replace values according to conditions

2008-04-09 Thread Guazzetti Stefano
A short way (not necessairly the best way), using the coercion from logical to numeric, could be: (mydata-as.data.frame(matrix(sample(1:9, 12, repl=T), ncol=4))) -1*(mydata =3) + (mydata =6) For the second question start here: help(Logic, package=base) Stefano -Messaggio

[R] problem with basic boolean selection in sequence

2008-04-09 Thread Benoit Ricci
Dear R users, I have a surprising problem while selecting values in a sequence created with the seq() function... I've tried a lot of test before sending this here and hope I did not disturb you for a foolish mistake from me Please, have a look at the following lines:

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

2008-04-09 Thread Ben Bolker
Ng Stanley stanleyngkl at 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

Re: [R] preallocating matrices and rda read-back objects

2008-04-09 Thread Uwe Ligges
Alexy Khrabrov wrote: I've read in Phil Spector's new book that it's a good idea to preallocate a big matrix, like u - matrix(0,nrow,ncol) # (1) Now, I read contents of a huge matrix from a Fortran binary dump. u - readBin(con,what=double,n=nrow*ncol) # (2) If I do (1) and then

[R] Odp: problem with basic boolean selection in sequence

2008-04-09 Thread Petr PIKAL
Hi Do not use computers, they are full of such traps and do not do what we think they do. See FAQ 7.31 Why doesn't R think these numbers are equal Regards Petr [EMAIL PROTECTED] [EMAIL PROTECTED] napsal dne 09.04.2008 11:32:00: Dear R users, I have a surprising problem while selecting

Re: [R] Smoothing 3 D data

2008-04-09 Thread Dieter Menne
Ruby_Stanford hiranakshidevi at gmail.com writes: Hey. I have a set of data points (x1,y1,z1; x2,y2,z2;...xn,yn,zn). I need to smooth these in 3D. For example if these were in 2 D then one would use inverse distance weighting or moving averages. interp.loess {tgp} is

Re: [R] java applets

2008-04-09 Thread Thomas Kaliwe
Hi, I used Rserve http://www.rforge.net/Rserve/ to use the facilities of R in a java applet. If you know how to write an applet, there are some examples of how to talk to Rserve from Java. Thomas Kaliwe lamack lamack schrieb: Dear all, is it possible to implement some statistics data

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 have

[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

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 -

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

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

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

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

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

[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

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

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

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 with a background

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

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:

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

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 your-video-drivers emerge -D mesa

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

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

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

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

[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

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

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

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 -

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] 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) axis(3,

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] 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 read the

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 * London * New

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 quick question:

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,

[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

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

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

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] Itsreally good [[3]] [1] Beautiful sapply(strapply(C, \\w+), tail, 1)

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 on

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 discussion

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] Itsreally [[3]] character(0) On Wed, Apr 9, 2008 at 11:56 AM, Gabor Grothendieck [EMAIL PROTECTED] wrote: See strapply

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

[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

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 combining diacritics.

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

[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') which

[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

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

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 additional

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

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

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

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 for

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

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,

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

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

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 knows help?

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)

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

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

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)

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

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 quotation

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

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

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

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

[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

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

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( *\\w+$, , x) But be aware

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

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

[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

[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

[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

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 expression

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

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

  1   2   >