Re: [R] Finding convex hull? [Broadcast]

2007-09-07 Thread Liaw, Andy
From: Dong-hyun Oh Dear UseRs, I would like to know which function is the most efficient in finding convex hull of points in 3(or 2)-dimensional case? Functions for finding convex hull is the following: convex.hull (tripack), chull (grDevices), in.chull (sgeostat), convhulln

Re: [R] Q: loess-like function that allows more predictors?

2007-09-07 Thread Liaw, Andy
locfit() in the locfit package can do that. Andy From: D. R. Evans I have a feeling that this may be a stupid question, but here goes anyway: is there a function that I can use to replace loess but which allows a larger number of predictors? (I have a situation in which it would be

Re: [R] Monotonic interpolation

2007-09-06 Thread Liaw, Andy
Not if Mr. excalibur really want interpolating (as oppose to smooting) splines. Other than linear, I'm not even sure if it can be done (though I'm no expert on this). One possibility is to use the cobs package and play with the amount of smoothing... Andy From: Bert Gunter

Re: [R] Recursive concatenation

2007-09-06 Thread Liaw, Andy
Or something like: R do.call(paste, c(expand.grid(LETTERS[1:3], 1:3), sep=)) [1] A1 B1 C1 A2 B2 C2 A3 B3 C3 (The ordering is bit different, but that shouldn't matter.) Andy From: Dimitris Rizopoulos try this: paste(rep(LETTERS[1:3], each = 3), 1:3, sep = ) Best, Dimitris

Re: [R] Synchronzing workspaces

2007-09-06 Thread Liaw, Andy
See the example in ?save on how to set defaults via options(). Andy From: Gabor Grothendieck You could try saving prior to quitting in the future if you want to try those arguments. On 9/3/07, Paul August [EMAIL PROTECTED] wrote: Thanks for sharing your experience. In my case, the

Re: [R] Variable Importance - Random Forest

2007-09-06 Thread Liaw, Andy
I'm slowly clearing my back-log of r-help messages... Please see reply inline below. Andy From: Mathe, Ewy (NIH/NCI) [F] Hello, I am trying to explore the use of random forests for classification and am certain about the interpretation of the importance measurements. When

Re: [R] categorical variable coefficients in QSAR [Broadcast]

2007-09-06 Thread Liaw, Andy
No one seemed to have picked up on this, so I'll take a stab: You need to read para and meta into R as factors, and if you want the coefficients to match the way you showed, you also need to take care that the factor levels are in the same order as you showed in the coefficient table. I

Re: [R] randomForest help

2007-09-06 Thread Liaw, Andy
What software are you using, exactly? I'm the maintainer of the randomForest package, yet I do not know which manual you are quoting. If you are using the randomForest package, the model object can be saved to a file by save(Rfobject, file=myRFobject.rda). If you need that to be in ascii, use

Re: [R] ecological meaning of randomForest vegetation classification? [Broadcast]

2007-09-05 Thread Liaw, Andy
Hi Christoph, I'm not exactly sure what you're looking for, but I'll take a stab anyway. The trees in a random forest is not designed to be interpreted as one would with an ordinary tree. There are several things you may try to see if they help you any. One is the distribution of votes. It

Re: [R] (Most efficient) way to make random sequences of random sequences

2007-08-21 Thread Liaw, Andy
Similarly: s - c(replicate(N, sample(3))) Andy From: roger koenker One way: N - 10 s - c(apply(matrix(rep(1:3,N),3,N),2,sample)) url:www.econ.uiuc.edu/~rogerRoger Koenker email[EMAIL PROTECTED]Department of Economics vox:

Re: [R] RFclustering - is it available in R?

2007-08-15 Thread Liaw, Andy
Basically the random forest algorithm can generate a proximity matrix of the data, and it's up to you how you would want to proceed from there. You can feed that into clustering algorithms that accept a similarity matrix, or turn it into a distance matrix for clustering algorithms that need a

Re: [R] Loading JMP Files

2007-08-15 Thread Liaw, Andy
JMP can write CSV, and that's probably a safer choice than XPT. Andy From: Diana C. Dolan Hi, I know how to use SPSS and JMP, and have quite a few JMP files I would like to use in R. I converted them to .xpt files, downloaded the 'foreign' library then tried this command:

Re: [R] rfImpute

2007-08-13 Thread Liaw, Andy
I seem to recall that rfImpute() can sometimes come up with NAs at some point in the iterations. Could you please send me a (small) set of data/code that reproduces the problem? Andy From: Eric Turkheimer I am having trouble with the rfImpute function in the randomForest package. Here is

Re: [R] Sourcing commands but delaying their execution

2007-08-03 Thread Liaw, Andy
Here's one possibility: The file garbage.R has x - rnorm(100) print(summary(x)) You can do: cmds - parse(file=garbage.R, n=NA) and when you want to execute those commands, do eval(cmds) Andy From: Dennis Fisher Colleagues: I have encountered the following situation:

Re: [R] getting the name of variables passed to a function

2007-07-30 Thread Liaw, Andy
Here's one possibility: R f - function(...) { call - match.call(); sapply(as.list(call[-1]), deparse) } R f(x, y) [1] x y R f(x=x, y=y) x y x y You basically need to know how to manipulate call objects. The relevant section in the R Language Definition should help. Andy From: Horace

Re: [R] randomForest importance problem with combine [Broadcast]

2007-07-24 Thread Liaw, Andy
I've been fixing some problems in the combine() function, but that's only for regression data. Looks like you are doing classification, and I don't see the problem: R library(randomForest) randomForest 4.5-19 Type rfNews() to see new features/changes/bug fixes. R set.seed(1) R rflist -

Re: [R] Viewing a data object

2007-06-13 Thread Liaw, Andy
I believe JGR has an object browser. See the screenshots at the bottom of http://rosuda.org/JGR/. Andy From: Stephen Tucker Hi Horace, I have also thought that it may be useful but I don't know of any Object Explorer available for R. However, (you may alread know this but) (1)

Re: [R] R for bioinformatics

2007-06-04 Thread Liaw, Andy
Just to complete this thread: A colleague sent me the following regarding the book. Following up on this post from a few months back... The author has recently posted a public-domain version of this book on CRAN under Documentation - Contributed - Statistics Using R with Biological

Re: [R] normality tests [Broadcast]

2007-05-25 Thread Liaw, Andy
From: [EMAIL PROTECTED] On 25/05/07, Frank E Harrell Jr [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Hi all, apologies for seeking advice on a general stats question. I ve run normality tests using 8 different methods: - Lilliefors - Shapiro-Wilk - Robust Jarque Bera

Re: [R] in unix opening data object created under win

2007-05-24 Thread Liaw, Andy
What are the versions of R on the two platform? Is the version on Unix at least as new as the one on Windows? Andy From: [EMAIL PROTECTED] Hi All I am saving a dataframe in my MS-Win R with save(). Then I copy it onto my personal AFS space. Then I start R and run it with emacs and

Re: [R] using lm() with variable formula [Broadcast]

2007-05-18 Thread Liaw, Andy
One way to do it is by giving a data frame with the right variables to lm() as the first argument each time. If lm() is given a data frame as the first argument, it will treat the first variable as the LHS and the rest as the RHS of the formula. As examples, you can do: lm(myData[c(height,

Re: [R] more woes trying to convert a data.frame to a numerical matrix

2007-05-16 Thread Liaw, Andy
I think this might be a bit more straight forward: R mat - do.call(cbind, scan(clipboard, what=list(NULL, 0, 0, 0), sep=,, skip=2)) Read 3 records R mat [,1] [,2] [,3] [1,]123 [2,]456 [3,]789 Andy From: Andrew Yee Thanks again to everyone for all

Re: [R] Testing for existence inside a function [Broadcast]

2007-05-15 Thread Liaw, Andy
Not sure which one you want, but the following should cover it: R f - function(x) c(x=missing(x), y=exists(y)) R f(1) x y FALSE FALSE R f() x y TRUE FALSE R y - 1 R f() xy TRUE TRUE R f(1) x y FALSE TRUE Andy From: Talbot Katz Hi. I'm having

Re: [R] Testing for existence inside a function

2007-05-15 Thread Liaw, Andy
. -- TMK -- 212-460-5430 home 917-656-5351 cell From: Liaw, Andy [EMAIL PROTECTED] To: Talbot Katz [EMAIL PROTECTED],r-help@stat.math.ethz.ch Subject: RE: [R] Testing for existence inside a function [Broadcast] Date: Tue, 15 May 2007 11:03:12 -0400 Not sure which one you want

Re: [R] Testing for existence inside a function

2007-05-15 Thread Liaw, Andy
! -- TMK -- 212-460-5430home 917-656-5351cell From: Liaw, Andy [EMAIL PROTECTED] To: Talbot Katz [EMAIL PROTECTED],r-help@stat.math.ethz.ch Subject: RE: [R] Testing for existence inside a function Date: Tue, 15 May 2007 11:41:17 -0400 Just need a bit more work: R f

Re: [R] Optimized File Reading with R

2007-05-15 Thread Liaw, Andy
If it's a matrix, use scan(). If the columns are not all the same type, use the colClasses argument to read.table() to specify their types, instead of leaving it to R to guess. That will speed things up quite a lot. Andy From: Lorenzo Isella Dear All, Hope I am not bumping into a FAQ, but

Re: [R] geeting name of an object to which a variable refers?

2007-05-11 Thread Liaw, Andy
Something like this? R f - function(x) deparse(substitute(x)) R a - 1:3 R f(a) [1] a Andy From: new ruser #Sorry for the convoluted subject line. #I have: a=c(1,2,3) x=a #example of user supplied input #Is there any function that will tell me the name of the object x refers

Re: [R] Allocating shelf space

2007-05-09 Thread Liaw, Andy
I don't know if there's an R solution, but this sounds to me like some variation of the knapsack problem... http://en.wikipedia.org/wiki/Knapsack_problem Andy From: [EMAIL PROTECTED] Hi Folks, This is not an R question as such, though it may well have an R answer. (And, in any case,

Re: [R] summing values according to a factor

2007-05-07 Thread Liaw, Andy
Howdy! I guess what you want to do is compare Q1/T1 among the sections? If you want to compute the sum of Q1/T1 by Section, you can do something like: sum.by.section - with(mydata, tapply(Q1/T1, section, sum)) Substitute sum with anything you want to compute. Cheers, Andy From: Salvatore

Re: [R] R package development in windows

2007-05-04 Thread Liaw, Andy
I guess it depends on what you want to be able to do with such a private package; e.g., does it not need to have any documentation (i.e., the Rd files)? If all you want is to be able to access the objects, you can just save() all those objects (mostly functions, I presume) in a .rda file, and

Re: [R] R question [Broadcast]

2007-05-04 Thread Liaw, Andy
Bill, A couple more points: 1. Please use an informative subject line. I'd deleted the original post w/o reading if I didn't catch Marc's reply. 2. Are you sure you have bivariate response? To me bivariate means two variables, and randomForest surely does not handle that (at least

Re: [R] how to concatinate the elements of some text vectors cat() or print() ?

2007-05-02 Thread Liaw, Andy
Is paste() what you're looking for? Andy From: John Kane I have some comment text taken from a SAS data file. It is stored in two vectors and is difficult to read. I would like to simply concatentate the individual entries and end up with a character vector that give me one line of text

[R] thousand separator (was RE: weight)

2007-04-30 Thread Liaw, Andy
I've run into this occasionally. My current solution is simply to read it into Excel, re-format the offending column(s) by unchecking the thousand separator box, and write it back out. Not exactly ideal to say the least. If anyone can provide a better solution in R, I'm all ears... Andy

Re: [R] thousand separator (was RE: weight)

2007-04-30 Thread Liaw, Andy
. -- Bert Bert Gunter Genentech Nonclinical Statistics -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marc Schwartz Sent: Monday, April 30, 2007 10:02 AM To: Liaw, Andy Cc: r-help@stat.math.ethz.ch Subject: Re: [R] thousand separator

Re: [R] thousand separator (was RE: weight)

2007-04-30 Thread Liaw, Andy
(DF) On 4/30/07, Liaw, Andy [EMAIL PROTECTED] wrote: Still, though, it would be nice to have the data read in correctly in the first place, instead of having to do this kind of post-processing afterwards... Andy From: Bert Gunter Nothing! My mistake! gsub -- not sub

Re: [R] NA and NaN randomForest

2007-04-25 Thread Liaw, Andy
Hi Clayton, If you use the formula interface, then it should do what you want: R library(randomForest) randomForest 4.5-18 Type rfNews() to see new features/changes/bug fixes. R iris1 - iris[-(1:5),] R iris2 - iris[1:5,] R iris2[1, 3] - NA R iris2[3, 1] - NA R iris.rf - randomForest(Species ~

Re: [R] Getting Confused [Broadcast]

2007-04-25 Thread Liaw, Andy
If you are serious in getting useful help, please do try to follow suggestions in the Posting Guide. You have not told us anything about your OS, the versions of R you tried to install, and exactly what you typed to build/install them. Many Linux distro by default do not install the Fortran part

Re: [R] how to convert the lower triangle of a matrix to a symmetricmatrix [Broadcast]

2007-04-20 Thread Liaw, Andy
Ranjan and Prof. Fox, Similar approach can be found in stats:::as.matrix.dist(). Andy From: John Fox Dear Ranjan, If the elements are ordered by rows, then the following should do the trick: X - diag(p) X[upper.tri(X, diag=TRUE)] - elements X - X + t(X) - diag(diag(X))

Re: [R] Suggestions for statistical computing course

2007-04-20 Thread Liaw, Andy
I really like John Monahan's Numerical Methods of Statistics (Cambridge University Press). As to running/editing R scripts, you may want to look into JGR. The built-in editor is not as smart as ESS in some respect, but smarter than ESS in others. The only thing that keep me from using it

Re: [R] Help on averaging sets of rows defined by row name

2007-04-20 Thread Liaw, Andy
You might want to check which of the following scales better for the size of data you have. ## Make up some data to try. R dat - data.frame(gene=rep(letters[1:3], each=3), s1=runif(9), s2=runif(9)) R dat genes1s2 1a 0.9959172 0.9531052 2a 0.2064497 0.4257022 3a

Re: [R] Help on averaging sets of rows defined by row name

2007-04-20 Thread Liaw, Andy
suggestion, or else he would have noticed the error. Andy From: Booman, M [mailto:[EMAIL PROTECTED] Sent: Friday, April 20, 2007 10:26 AM To: Liaw, Andy; r-help@stat.math.ethz.ch Subject: RE: [R] Help on averaging sets of rows defined

Re: [R] How to return more than one variable from function

2007-04-20 Thread Liaw, Andy
From: Vincent Goulet Le Vendredi 20 Avril 2007 07:46, Julien Barnier a écrit : Hi, I have written a function which computes variance, sd, r^2, R^2adj etc. But i am not able to return all of them in return statement. You can return a vector, or a list. For example : func

Re: [R] Udpate R under a proxy

2007-04-20 Thread Liaw, Andy
This is what I just tried (thanks, Dirk!): Start R and then Sys.putenv(http_proxy, whatever), options(download.file.method=wget) doesn't work. Open up a command prompt, define http_proxy there, then run Rgui. Set options(download.file.method=wget). This works. Perhaps you can define

Re: [R] general question about plotting multiple regression results [Broadcast]

2007-04-19 Thread Liaw, Andy
I suspect you'll greatly benefit a read of Prof. Fox's book(s) on regression models, as well as making use of his car package. You may want to read up on partial residual plots and partial regression plots. Andy From: Simon Pickett Hi all, I have been bumbling around with r for years now

Re: [R] R in cron job: X problems

2007-04-19 Thread Liaw, Andy
This is in the FAQ, if I remember correctly... However, alternatively: As Jeff Horner recently pointed out on the list, the Cairo package is a good way of generating png without needing an X display. You may want to look into that. I've just installed cairo on our CentOS boxes and the Cairo

Re: [R] installing new packages

2007-04-13 Thread Liaw, Andy
See if 2.19 The Internet download functions fail in the R for Windows FAQ helps. Andy From: Bill Shipley Hello, I have just installed the newest version of R (2.4.1) for Windows XP. I can no longer install new packages. When trying to connect to a server (I have tried several)

Re: [R] Subsetting list of vectors with list of (boolean) vectors?

2007-04-12 Thread Liaw, Andy
From: Marc Schwartz On Thu, 2007-04-12 at 18:12 +0200, Johannes Graumann wrote: Dear Rologists, I'm stuck with this. How would you do this efficiently: aPGI [[1]] [1] 864 5576 aPGItest [[1]] [1] TRUE FALSE result - [magic box involving subset) result

Re: [R] Random Forest Imputations [Broadcast]

2007-04-11 Thread Liaw, Andy
Please provide the information the posting guide asks (version of R, packages used, version of package used, etc). There are no yaImpute() or yai() functions in the randomForest package. Andy From: [EMAIL PROTECTED] on behalf of Ricky Jacob Sent: Wed

Re: [R] Random Forest Imputations [Broadcast] [Broadcast]

2007-04-11 Thread Liaw, Andy
authors would like me to add some feature to the randomForest package (which I maintain). I'll look into that. Andy From: Ricky Jacob [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 11, 2007 7:11 AM To: Liaw, Andy Cc: r-help

Re: [R] Reasons to Use R [Broadcast]

2007-04-11 Thread Liaw, Andy
From: Douglas Bates On 4/10/07, Wensui Liu [EMAIL PROTECTED] wrote: Greg, As far as I understand, SAS is more efficient handling large data probably than S+/R. Do you have any idea why? SAS originated at a time when large data sets were stored on magnetic tape and the only

Re: [R] Reasons to Use R [Broadcast]

2007-04-09 Thread Liaw, Andy
I've probably been away from SAS for too long... we've recently tried to get SAS on our 64-bit Linux boxes (because SAS on PC is not sufficient for some of my colleagues who need it). I was shocked by the quote for our 28-core Scyld cluster--- the annual fee was a few times the total cost of our

Re: [R] subset [Broadcast]

2007-03-26 Thread Liaw, Andy
From: Thomas Lumley On Mon, 26 Mar 2007, Marc Schwartz wrote: Sergio, Please be sure to cc: the list (ie. Reply to All) with follow up questions. In this case, you would use %in% with a negation: NewDF - subset(DF, (var1 == 0) (var2 == 0) (!var3 %in% 2:3)) Probably a

Re: [R] frequency tables and sorting by rowSum

2007-03-24 Thread Liaw, Andy
1. This is probably overkill, but works: as.data.frame(table(as.data.frame(m))) V1 V2 V3 Freq 1 0 0 00 2 1 0 02 3 0 1 03 4 1 1 00 5 0 0 11 6 1 0 10 7 0 1 10 8 1 1 10 You can easily get rid of 0-frequency rows afterward. 2. Not sure

Re: [R] Get home directory and simple I/O

2007-03-23 Thread Liaw, Andy
From: Gabor Grothendieck See: ?R.home That's not what Alberto wanted: It gives the location of the R installation, not where user's home directory is. AFAIK Windows does not set the HOME environment variable by default. ?dput On 3/23/07, Alberto Monteiro [EMAIL PROTECTED] wrote: Is

Re: [R] objects of class matrix and mode list? [Broadcast]

2007-03-23 Thread Liaw, Andy
It may help to (re-)read ?sapply a bit more in detail. Simplification is done only if it's possible, and what possible means is defined there. A list is a vector whose elements can be different objects, but a vector nonetheless. Thus a list can have dimensions. E.g., R a - list(1, 1:2, 3,

Re: [R] how to get lsmeans?

2007-03-22 Thread Liaw, Andy
Brian Ripley Sent: Wednesday, March 21, 2007 12:03 PM To: Chuck Cleland Cc: r-help Subject: Re: [R] how to get lsmeans? On Wed, 21 Mar 2007, Chuck Cleland wrote: Liaw, Andy wrote: I verified the result from the following with output from JMP 6

Re: [R] how to get lsmeans?

2007-03-21 Thread Liaw, Andy
I verified the result from the following with output from JMP 6 on the same data (don't have SAS: don't need it): set.seed(631) n - 100 dat - data.frame(y=rnorm(n), A=factor(sample(1:2, n, replace=TRUE)), B=factor(sample(1:2, n, replace=TRUE)),

Re: [R] package:AlgDesign and .Random.seed [Broadcast]

2007-03-21 Thread Liaw, Andy
From: Michael Kubovy On Mar 21, 2007, at 4:16 AM, Uwe Ligges wrote: Michael Kubovy wrote: Dear r-helpers, Could you please help me solve the following problem: When I run require(AlgDesign) trt - LETTERS[1:5] blk - 10 trtblk - 3 BIB - optBlock(~., withinData = trt, blocksizes

Re: [R] Select the last two rows by id group

2007-03-20 Thread Liaw, Andy
Something like the following should work: last.n - function(x, n) { last - nrow(x) x[(last - n + 1):last, , drop=FALSE] } ## Example: get the last two rows. do.call(rbind, lapply(split(score, score$id), last.n, 2)) You might want to add a check in last.n() to make sure that there are at

Re: [R] Bad points in regression [Broadcast]

2007-03-16 Thread Liaw, Andy
(My turn on the soapbox ...) I'd like to add a bit of caveat to Bert's view. I'd argue (perhaps even plead) that robust/resistant procedures be used with care. They should not be used as a shortcut to avoid careful analysis of data. I recalled that in my first course on regression, the

Re: [R] how to assign fixed factor in lm

2007-03-08 Thread Liaw, Andy
Either you did not read docs sufficiently carefully, or the source where you learn to do this from is questionable. The lm() function has no argument called fixed, and the warning should have made that clear to you. It was sheer luck on your part that you happen to put Value as the first

Re: [R] 0 * NA = NA

2007-03-05 Thread Liaw, Andy
From: Alberto Monteiro Is there any way to force 0 * NA to be 0 instead of NA? For example, suppose I have a vector with some valid values, while other values are NA. If I matrix-pre-multiply this by a weight row vector, whose weights that correspond to the NAs are zero, the outcome

Re: [R] how to apply the function cut( ) to many columns in a data.frame?

2007-03-01 Thread Liaw, Andy
From: Chuck Cleland ahimsa campos-arceiz wrote: Dear useRs, In a data.frame (df) I have several columns (x1, x2, x3xn) containing data as a continuous numerical response: df var x1x2 x3 1143 147 137 2 9393 117 316439 101

Re: [R] How to read in this data format?

2007-03-01 Thread Liaw, Andy
You can't expect general-purpose tools like read.table in R to be able to deal with highly specialized file format. Here's what I'd start. It doesn't put data in the format you specified exactly, but I doubt you'll need that. This might be sufficient for your purpose: dat -

Re: [R] Package RGtk2, rattle, libatk-1.0.0.dll Errors

2007-02-28 Thread Liaw, Andy
The way I have that problem resolved is by installing the rggobi package using the command shown on http://www.ggobi.org/rggobi/, which is source(http://www.ggobi.org/download/install.r;) That will install all the things that Ggobi needs. Since rattle depends on rggobi, it's probably a good

Re: [R] Multiple conditional without if [Broadcast]

2007-02-27 Thread Liaw, Andy
From: bunny, lautloscrew.com Dear all, i am stuck with a syntax problem. i have a matrix which has about 500 rows and 6 columns. now i want to kick some data out. i want create a new matrix which is basically the old one except for all entries which have a 4 in the 5 column AND a 1

Re: [R] how to use apply with two variables

2007-02-23 Thread Liaw, Andy
Yes. Just try it and see. BTW, your usage of return() is not recommended anymore. This is probably easier: myfun-function(x) c(mean=mean(x), sd=sd(x)) out - apply(mat, 1, myfun) ## or... out2 - cbind(mean=rowMeans(mat), sd=sd(t(mat))) Andy From: Serguei Kaniovski Hi, this is a

Re: [R] JGR launcher for linux

2007-02-22 Thread Liaw, Andy
Isn't it right in front of you? I get: JGR() Starting JGR ... (You can use /usr/local/lib64/R/library/JGR/cont/run to start JGR directly) ^^^ Andy From: Ronaldo Reis Junior Hi, anybody have a JGR launcher for linux? Maybe a script that

Re: [R] memory management uestion [Broadcast]

2007-02-20 Thread Liaw, Andy
I don't see why making copies of the columns you need inside the loop is better memory management. If the data are in a matrix, accessing elements is quite fast. If you're worrying about speed of that, do what Charles suggest: work with the transpose so that you are accessing elements in the

Re: [R] rpart tree node label [Broadcast]

2007-02-14 Thread Liaw, Andy
Try the following to see: library(rpart) iris.rp(Sepal.Length ~ Species, iris) plot(iris.rp) text(iris.rp) Two possible solutions: 1. Use text(..., pretty=0). See ?text.rpart. 2. Use post(..., filename=). Andy From: Wensui Liu not sure how you want to label it. could you be more

Re: [R] [BioC] Outlook does threading [Broadcast]

2007-01-31 Thread Liaw, Andy
This is really off-topic for both BioC and R-help, so I'll keep it short. From: Kimpel, Mark William See below for Bert Gunter's off list reply to me (which I do appreciate). I'm putting it back on the list because it seems there is still confusion regarding the difference between

Re: [R] Memory problem on a linux cluster using a large data set [Broadcast]

2006-12-18 Thread Liaw, Andy
In addition to my off-list reply to Iris (pointing her to an old post of mine that detailed the memory requirement of RF in R), she might consider the following: - Use larger nodesize - Use sampsize to control the size of bootstrap samples Both of these have the effect of reducing sizes of trees

Re: [R] plot.svm

2006-12-08 Thread Liaw, Andy
Try debug(e1071:::plot.svm) and then re-run your plot command, stepping through one line at a time and see where it fails. Andy From: Aimin Yan where is plot.svm method? I just find plot(svm, data, formula) method Aimin __

Re: [R] any way to make the code more efficient ?

2006-12-08 Thread Liaw, Andy
I don't know about efficiency, but at least for readability, you may want to do the following: 1. Indent your code. 2. Create a list of appropriate length, and populate the list with objects you're creating in the loop. 3. After the loop, use do.call(rbind, list). HTH, Andy From: Leeds, Mark

Re: [R] from table to dataframe

2006-12-05 Thread Liaw, Andy
Like this? R data.frame(unclass(df2)) a b c d s1 8 4 4 4 s2 8 4 4 4 s3 8 4 4 4 Andy From: Milton Cezar Ribeiro Hi there, I have a two-entrance dataframe, and I would like generate a new dataframe with its frequency. I tryed this site-rep(c(s1,s2,s3),20)

Re: [R] Count cases by indicator

2006-12-04 Thread Liaw, Andy
I might be missing something, but the data you showed don't seem to match your expectation. Firstly, 1 in binary is 511 in decimal, so your coordinates are off by 1. Secondly, for the data you've shown, the matrix equivalent look like: m - matrix(df$x, ncol=9, byrow=TRUE) rownames(m) -

Re: [R] automatic cleaning of workspace

2006-11-28 Thread Liaw, Andy
You can avoid loading .Rdata at start-up without deleting the .Rdata file by adding the --no-restore option to the R command. I have that, and additionally, --no-save, in my shortcut for the Rgui.exe command. I use explicit save() and load() in my scripts to save objects that are expensive to

Re: [R] random forest regression

2006-11-15 Thread Liaw, Andy
One way is to graft the stratified sampling code from the classification part onto the regression part. I will get to it eventually, but just not now. Andy From: Naiara Pinto Dear all, I am doing a regression in ramdomForest, using the option sampsize reduce the number of records used

Re: [R] CPU or memory

2006-11-08 Thread Liaw, Andy
My understanding is that it doesn't have much to do with 32- vs. 64-bit, but what the instruction sets of the CPUs. If I'm not mistaken, at the same clock speed, a P4 would run slower than PIII simply because P4 does less per clock-cycle. Also, I believe for the same architecture, single core

[R] graphics ignore tabs in text

2006-10-31 Thread Liaw, Andy
Dear R-help, I seem to recall that I can use \t to get tab in a string on a graphics device, but it doesn't seem to work. Try: lab - a\tb\tc cat(lab, \n) # works in the console output plot(1:5, main=lab) # no tabs in the title text(3, 3, lab) # no tabs in the text I get the same

Re: [R] one problem about how to hold graphic with R

2006-10-31 Thread Liaw, Andy
I'm not familiar with Matlab, but from what I know, hold on is used to overlay more stuff on the existing plot. In R such things are accomplished a bit differently: One put up a plot, then use things like lines(), points(), abline(), etc. to add to the existing plot. The closest thing to hold

Re: [R] regarding large csv file import [Broadcast]

2006-10-27 Thread Liaw, Andy
TFM (R Data Import/Export manual in this case) can be a better place to look than the archive. Try specifying colClasses in read.csv() might help. Andy From: [EMAIL PROTECTED] hi All, i have a .csv of size 272 MB and a RAM of 512MB and working on windows XP. I am not able to

Re: [R] how to improve the efficiency of the following lapply codes [Broadcast]

2006-10-26 Thread Liaw, Andy
Make good use of Rprof(): It has helped me a great deal in pinpointing bottlenecks where I would not have suspected. Cheers, Andy From: Weiwei Shi object.size(intersect.matrix) 41314204 but my machine has 4 G memory, so it should be ok since after 12 hours, it finishes 16k out of 60k

Re: [R] binom.test [Broadcast]

2006-10-21 Thread Liaw, Andy
To quote one of the previous answers you've got: The formula you're using is the TV. The one binom.test() uses is the ballpark. Take your pick. Andy From: Ethan Johnsons Thank you for the info. It helps. After all, it would be: 0.1304348-1.96*(sqrt((0.1304348*(1-0.1304348))/46))

Re: [R] Box M test [Broadcast]

2006-10-21 Thread Liaw, Andy
See http://finzi.psych.upenn.edu/R/Rhelp02a/archive/0.html Andy From: GRAHAM LEASK Dear List I am looking for a script that will calculate the Box M test to test the homogeneity of the variance/covariance matrix between two matrices. If anyone could send me the

Re: [R] Getting group size in a data frame [Broadcast]

2006-10-19 Thread Liaw, Andy
Is this sort of what you want? R aggregate(df[2:3], df[1], function(x) sum(!is.na(x))) factor val1 val2 1 2421 Andy From: Ulrik Stervbo Hi all, I have a data frame with some measured values of some animals. Sometimes the measurement failed, resulting in a NA for a

Re: [R] Question about random sampling in R

2006-10-19 Thread Liaw, Andy
When sampling with replacement (like ordinary bootstrap), each draw is done independently, and in each draw every point has equal probability of being drawn. When sampling without replacement (random permutation), all possible sequences (permutations) have equal probability of occurring. E.g.,

Re: [R] [Q] How to fit data to HORIZONTAL line [Broadcast]

2006-10-19 Thread Liaw, Andy
The horizontal line can be fitted by lm(y ~ 1). Andy From: Young-Jin Lee Dear R users I posted a question about how to fit data to a straight line this afternoon. But I realized that my question was not correct because I needed to fit data to a HORIZONTAL line, not a ordinary

Re: [R] MARS help?

2006-10-18 Thread Liaw, Andy
Spencer, MARS fits splines, not disconnected lines. Perhaps the strucchange package has facility to fit your data better. Cheers, Andy From: [EMAIL PROTECTED] on behalf of Spencer Graves Sent: Tue 10/17/2006 11:43 PM To: R-help; Kurt Hornik Subject: [R]

Re: [R] Automatic File Reading [Broadcast]

2006-10-18 Thread Liaw, Andy
Works on all platforms: flist - list.files(path=file.path(somedir, somewhere), pattern=[.]csv$) csvlist - lapply(flist, read.csv, header=TRUE) whateverList - lapply(csvlist, whatever) Andy From: Richard M. Heiberger Wensui Lui asks: is there a similar way to read all

Re: [R] Nested source() errors [Broadcast]

2006-10-18 Thread Liaw, Andy
I've seen people doing that without problem. Not something I'd like to do myself, precisely because when problems occur, it's difficult to figure out what went wrong. Such practice usually indicate that you ought to organize your functions better. (You _are_ writing functions, instead of just

Re: [R] CI

2006-10-18 Thread Liaw, Andy
Here's one way: R x - c(6,11,5,14,30,11,17,3,9,3,8,8) R confint(lm(x~1), level=.9) 5 %95 % (Intercept) 6.546834 14.2865 Andy From: Ethan Johnsons I have a quick question, please. Does R have function to compute i.e. a 90% confidence interval for the mean for these

Re: [R] CI

2006-10-18 Thread Liaw, Andy
of 1? i.e. where 1 = apple; 2 = orange x [1] 2 2 2 2 2 1 1 2 2 1 2 1 2 2 2 1 1 1 1 1 1 1 2 2 2 table (x) x 1 2 11 14 x =11 confint(lm(x~1), level=0.90) 5 % 95 % (Intercept) NaN NaN ej On 10/18/06, Liaw, Andy [EMAIL PROTECTED] wrote: Here's one way: R x

Re: [R] Help on Random forest [Broadcast]

2006-10-11 Thread Liaw, Andy
Do provide a reproducible example, as the Posting Guide suggests. Try: library(randomForest) example(predict.randomForest) iris.pred - predict(iris.rf, iris[ind == 2,], nodes=TRUE) str(iris.pred) attr(iris.pred, nodes) Andy From: Rupendra Hello all, I am trying to explore random forest

Re: [R] how to convert all columns of a data frame into factors

2006-10-04 Thread Liaw, Andy
Alternatively: x[] - lapply(x, factor) Recall that a data frame is a list, so lapply() is a natural choice. Andy From: Gabor Grothendieck Try this: replace(BOD, TRUE, lapply(BOD, factor)) On 10/4/06, Weiwei Shi [EMAIL PROTECTED] wrote: Hi, I use apply apply(x, 2, factor)

[R] how do I tell configure where to find Java?

2006-10-03 Thread Liaw, Andy
Dear R-help, I'm trying to build R-2.4.0 on our Opteron-based Scyld cluster. The system has gcj (the GNU Java compiler, part of GCC) stuff in /usr/bin. When I installed jdk 1.5.08, the install script placed it in /usr/java (I didn't have a choice, as the script didn't offer that option). Now

Re: [R] how do I tell configure where to find Java? [Broadcast]

2006-10-03 Thread Liaw, Andy
- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Liaw, Andy Sent: 03 October 2006 19:40 To: r-help Subject: [R] how do I tell configure where to find Java? Dear R-help, I'm trying to build R-2.4.0 on our Opteron-based Scyld cluster. The system has gcj (the GNU Java

Re: [R] how do I tell configure where to find Java?

2006-10-03 Thread Liaw, Andy
FC. The JDK is from Sun, and didn't come as a RPM. Best, Andy From: Peter Dalgaard Logan Lewis [EMAIL PROTECTED] writes: Andy, On Tuesday 03 October 2006 3:30 pm, Liaw, Andy wrote: Before I do that, I would need to remove the gcj stuff that are in /usr/bin. If I know how

Re: [R] levels of factor when subsetting the factor

2006-09-12 Thread Liaw, Andy
You have at least two choices: R factor(fact[1:6]) [1] A A A B B B Levels: A B R fact[1:6, drop=TRUE] [1] A A A B B B Levels: A B HTH, Andy From: Afshartous, David All, When I take a subset of a factor the reduced factor still maintains all the original levels of the factor when say

Re: [R] 4^2 factorial help

2006-08-18 Thread Liaw, Andy
If you really want the quadratic terms, you need to keep those variables as numeric, instead of factors. (You might also want to look into something like the central composite designs.) summary() and coef() on the resulting fitted object should give you want you need. Things like these are

  1   2   3   4   5   6   7   8   9   10   >