Re: [R] Analyzing dendograms??

2004-01-04 Thread Thomas W Blackwell
Johan - Disclaimer: I've never used heatmap(), so probably I shouldn't be answering this. However ... the function heatmap() probably calls either plot() or image() (regular graphics) or xyplot() (lattice graphics) in order to set up axes and initialize the actual plotting. heatmap() may

Re: [R] (no subject)

2003-12-23 Thread Thomas W Blackwell
Florian - One thing to *try* would be: work from the R command line and set the parameter "nlines" in read.table() to one less than the number of lines of data in the file. If this works, then you can at least read in all but the last line. I suspect something like a missing newline character

Re: [R] error propagation - hope it is correct subject

2003-12-23 Thread Thomas W Blackwell
0) vysled[i]<-sd(sample(y,100)) > mean(vysled) > > to get bootstraped estimation of sd(y) > > My actual data have some missing values and some outliers which I can either > remove or to use some robust statistics for mean and variation estimates. > > Thank you and

Re: [R] error propagation - hope it is correct subject

2003-12-22 Thread Thomas W Blackwell
Petr - Very briefly, I think of three ways to approximate the standard deviation of y = f(x1,x2,x3). (1) linearise f() and use the covariance matrix of [x1,x2,x3]. (2) simulate draws from the joint distribution of [x1,x2,x3], then compute the sample std dev of resulting f()s. (3)

Re: [R] [Mailman] question: contour plot for discrete data

2003-12-21 Thread Thomas W Blackwell
Dear L Z - Before using contour() one needs to interpolate the z values to all points in a rectangular grid. 2D interpolation is not trivial. The package KernSmooth (case-sensitive) will do this for a density estimate but not, apparently, when z values are given. Perhaps packages splines or

Re: [R] weighted regression

2003-12-19 Thread Thomas W Blackwell
Rex - Yes, you have supplied an appropriate 'weight' argument given the problem description in the paragraph which begins 'Assume that ...'. Your example would be much easier to read if the variable names 'x' and 'y' in the R code matched their usage in the paragraph description, rather than tra

Re: [R] Question re labels in r-part (continuation of a thread from a while back)

2003-12-19 Thread Thomas W Blackwell
Peter - (Just gessing about the structure of rpart objects ...) How about tr.totpart.pruned$frame <- cbind(tr.totpart.pruned$frame, meanpart = exp(tr.totpart.pruned$frame$yval)-1) This appends meanpart as an additional column of tr.totpart.pruned$frame. After this step

Re: [R] mclust - clustering by spatial patterns

2003-12-18 Thread Thomas W Blackwell
On Fri, 19 Dec 2003, Murray Jorgensen wrote: > Thomas W Blackwell wrote: > > > [...] > > Why not simply use dist() and hclust() ? Starting with > > presence/absence data, what could mclust() possibly do that > > is different from hclust() ? > > Um

Re: [R] mclust - clustering by spatial patterns

2003-12-18 Thread Thomas W Blackwell
On Thu, 18 Dec 2003, Jarrod Hadfield wrote: > Dear All, > > I have spatial data (presence/absence for 4000 squares) on 250 bird > species and would like to use a model-based clustering technique to > test for species associations. Is there any way of passing a > distance/correlation matrix to mcl

Re: [R] help installing Design package OS-X

2003-12-18 Thread Thomas W Blackwell
Frank - I recall some recent discussion on this list about installing Design on a Mac. Try the mail archive for a message from Frank Harrell, the package author and maintainer within the last five weeks. Your question sounds very similar to the question I remember . . . but mine is only a human

Re: [R]: Lp norm estimation

2003-12-18 Thread Thomas W Blackwell
Allan - Brian Ripley's implementation of one of the more useful Lp norms is: library("lqs") help("lqs") This is very highly recommended for practical data analysis. - tom blackwell - u michigan medical school - ann arbor - On Thu, 18 Dec 2003, allan clark wrote: > Hi all > > Just wonde

Re: [R] NUMERIC DERIVATE

2003-12-17 Thread Thomas W Blackwell
On Wed, 17 Dec 2003, Savano S. Pereira wrote: > UseRs, > > I used the optim function > > valor.optim <- optim(c(1,1,1),logexp1,method > ="BFGS",control=list(fnscale=-1),hessian=T); > > and I want to calculate the derivates, [ ... snip ... ] > > but I found, [ ... snip ... ] > > The derivates are

Re: [R] reverse lexicographic order

2003-12-14 Thread Thomas W Blackwell
Murray - If you could guarantee that all of the email addresses have exactly one occurrence of the "@" character in them, then something like spit <- do.call("rbind", strsplit(addresses, "@", FALSE)) will produce a data frame with either two or three character vectors as the columns, in which u

Re: [R] CLEDITOR

2003-12-12 Thread Thomas W Blackwell
(oops, wrong keystroke) ... in the unix source directories (at least for Redhat linux) on CRAN. - tom blackwell - u michigan medical school - ann arbor - On Fri, 12 Dec 2003, Stephen Dicey wrote: > How can I set up the CLEDITOR (command line) variable in R if there is > one? I am on a Sol

Re: [R] CLEDITOR

2003-12-12 Thread Thomas W Blackwell
Stephen - If command line editing does not work as it should, I would look first into providing a patched readline. See Graeme Ambler's patched version in On Fri, 12 Dec 2003, Stephen Dicey wrote: > How can I set up the CLEDITOR (command line) variable in R if there is > one? I am on a Solaris

Re: [R] an eval/parse trivia

2003-12-10 Thread Thomas W Blackwell
Vincent - >From the values shown, this looks like a Bioconductor question, rather than base R. You might try the maintainers of whatever package the function comes from. Is 2287 the index in "levels" for one of the character strings shown ? - tom blackwell - u michigan medical school - an

Re: [R] Scatterplot axes

2003-12-10 Thread Thomas W Blackwell
Ellen - plot(my.x.vector, my.y.vector, xlim=c(-3,3), ylim=c(-3,3)) It's the named arguments xlim and ylim that you were looking for. I frequently set them as xlim = 3 * c(-1,1), ylim = 3 * c(-1,1) so that I can change the range by editing just one number rather than two. For an added fillip, t

Re: [R] histogram density division

2003-12-09 Thread Thomas W Blackwell
Mathieu - That's easy. Assign the return value of hist() to some variable, say "fixed", then go in and hack the value of fixed$counts however you like, and re-plot using plot(fixed). Example code: fixed <- hist(rnorm(2000)) fixed$counts <- fixed$counts / 5 plot(fixed) I confess I didn't quite

Re: [R] non-uniqueness in cluster analysis

2003-12-03 Thread Thomas W Blackwell
Bruno - Many people add a tiny random number to each of the distances, or deliberately randomize the input order. This means that any clustering is not reproducible, unless you go back to the original randoms, but it forces you not to pay attention to minor differences. Ah, I think you're askin

Re: [R] amap : hclust agglomeration

2003-12-03 Thread Thomas W Blackwell
Thomas - "sup" stands for "supremum" or "maximum". The criterion for complete linkage clustering is that the two groups with the smallest maximum distance between any of their members will be joined at each stage. (I dare say you will have recieved many similar responses already, but none on-li

Re: [R] reason for Factors -- was -- Vector Assignments

2003-12-03 Thread Thomas W Blackwell
On Wed, 3 Dec 2003, Arend P. van der Veen wrote: > Your recommendations have worked great. I have found both cut and > ifelse to be useful. > > I have one more question. When should I use factors over a character > vector. I know that they have different uses. However, I am still > trying to f

Re: [R] Help with this topic

2003-12-01 Thread Thomas W Blackwell
Stephen - If the four columns shown below are in this order in a data frame named 'data', then use covariances <- by(data[ ,-1], data$Class, cov) to get the covariance matrices within each of the four classes. Alternative functions would be tapply() or aggregate(), but the syntax for by()

Re: [R] smoothing functions

2003-12-01 Thread Thomas W Blackwell
Eugene - Is the estimand in your problem (the parameter which you seek to estimate) discrete-valued or continuous-valued ? If it is discrete-valued, then you are heading in the wrong direction, because no matter how smooth you make the objective function, you will not be able to differentiate it

Re: [R] Vector Assignments

2003-12-01 Thread Thomas W Blackwell
Arend - Here is a sequence of commands which will do it. These first build a vector of (4+1) cutpoints, then cut() returns a factor whose labels are the colors and codes are determined by x. Last, as.character() turns the factor into the character vector which you ask for. Or, perhaps the fa

Re: [R] compile problem with gzfile

2003-11-29 Thread Thomas W Blackwell
William - I don't have an answer for you, just some stream of consciousness rambling about how I would go about diagnosing this, if it were my problem. In my installation directory (of R-1.7.1 on linux) there is a file config.log which contains all of the configure script's queries and replies

Re: [R] statistical prediction for glm()

2003-11-24 Thread Thomas W Blackwell
Martin - Do you want a goodness of fit measure for a Poisson glm ? I would start py plotting the residuals and doing an analysis of deviance on nested models. See McCullagh and Nelder, as well as more recent references. - tom blackwell - u michigan medical school - ann arbor - On Fri, 2

Re: [R] statistical prediction for glm()

2003-11-24 Thread Thomas W Blackwell
Martin - I can't figure out what question you are asking. Does either predict.glm() in the base package or cv.glm() in the boot package do what you want ? The theory for all of this is given in the references listed in the help pages for "glm" and "cv.glm". - tom blackwell - u michigan

Re: [R] kruskal wallis for manova?

2003-11-21 Thread Thomas W Blackwell
irst place. - tom blackwell - u michigan medical school - ann arbor - On Fri, 21 Nov 2003, Thomas W Blackwell wrote: > Nicolaas - > > help.search("kruskal") returns: > > kruskal.test(ctest) Kruskal-Wallis Rank Sum Test > > This means that the function i

Re: [R] kruskal wallis for manova?

2003-11-21 Thread Thomas W Blackwell
Nicolaas - help.search("kruskal") returns: kruskal.test(ctest) Kruskal-Wallis Rank Sum Test This means that the function is kruskal.test() in the ctest package. In order to run it, you must do library("ctest") first. HTH - tom blackwell - u michigan medical school - ann arbor

Re: [R] Problem with Trellis graphics in nlme

2003-11-20 Thread Thomas W Blackwell
Anthony - It seems just possible that the difficulty may have nothing to do with nlme() or any other data analysis. The graph you describe could result if one of the y-values was five time as large as any of the others. This could result from an error in reading the data input file, a missing

Re: [R] file not found?

2003-11-19 Thread Thomas W Blackwell
Kenneth - I recall a message on the [r-pkgs] list from Ray Brownrigg on November 1 this year that may be relevant. At that time he was announcing the availability of maps_2.0-8.zip and some other packages. Therefore, 2.0-10 must be *very* recent and might still be going through the CRAN prop

Re: [R] sampling without repetition

2003-11-17 Thread Thomas W Blackwell
n = length(r). - tom blackwell - u michigan medical school - ann arbor - On Mon, 17 Nov 2003, Rajarshi Guha wrote: > On Mon, 2003-11-17 at 20:01, Thomas W Blackwell wrote: > > Rajarshi - > > > > Do you want three sets, three disjoint sets, or sets of > > si

Re: [R] sampling without repetition

2003-11-17 Thread Thomas W Blackwell
Rajarshi - Do you want three sets, three disjoint sets, or sets of size three ? It's not clear what you are attempting to do. - tom blackwell - u michigan medical school - ann arbor - On Mon, 17 Nov 2003, Rajarshi Guha wrote: > Hi, > I'm trying to write a function that will divide a g

Re: [R] cumulative distribution functions

2003-11-17 Thread Thomas W Blackwell
Try help("INSTALL") (case-sensitive). - tom blackwell - u michigan medical school - ann arbor - On Mon, 17 Nov 2003, Monica Palaseanu-Lovejoy wrote: > hi y'all, > > I am wondering if there is any special command, function, > package, etc to help me doing a cumulative distribution functi

Re: [R] gradient option in "nlm" function

2003-11-17 Thread Thomas W Blackwell
On Mon, 17 Nov 2003 [EMAIL PROTECTED] wrote: > Dear list members, > > I am trying to use "nlm" function to maximize a mixture likelihood of beta > densities. There are five unknown parameters in the likelihood. Since I can > get the analytic gradient, I attach the "gradient" attribute in my target

Re: [R] Vector indices and minus sign

2003-11-14 Thread Thomas W Blackwell
David - I had to try your example verbatim before I understood what is happening. index <- numeric() creates a vector with no entries. Therefore the subscript is neither positive or negative, rather it contains no numeric values, so the return contains no entries either. Works the same in R-1.7

Re: [R] question about matrix

2003-11-12 Thread Thomas W Blackwell
Mikyoung - All answers are "yes", but IMHO you are trying to be too clever with your data structure. Programming is *much* easier if you keep things simple. Specifically: (1) The function matrix() will happily build you a matrix of type "list", with each element of the list occupying one ce

RE: [R] Memory issues..

2003-11-12 Thread Thomas W Blackwell
Jesper - (off-list) Jim MacDonald reports seeing different memory-management behavior between Windows and Linux operating systems on the same, dual boot machine. Unfortunately, this is happening at the operating system level, so the R code cannot do anything about it. I have cc'ed Jim on this

Re: [R] boot package question: sampling on factor, not row

2003-11-11 Thread Thomas W Blackwell
> On Mon, 10 Nov 2003, Thomas W Blackwell wrote: > > > The second argument to boot(), called 'statistic', can be > > any user-written function you want to cook up, with additional > > arguments being passed to it through the '...' mechanism after >

Re: [R] Reading an upper triangular matrix

2003-11-10 Thread Thomas W Blackwell
Kjetil - Frankly, your file would be much, much easier to read if it didn't have a row name at the beginning of each line. Any chance you can edit it to remove those ? Then, I think you could read in the numeric data with just one call to scan: mat <- matrix(0, 21, 21) mat[row(mat) >= col(mat

Re: [R] relationship between two discrete variables

2003-11-10 Thread Thomas W Blackwell
Paul - This situation seems like an obvious candidate for a log-linear model. See the book MASS for details. They're beyond the scope of this list. Or try help.search("log-linear"). (and ... can you find a way to break lines when sending your email ?) - tom blackwell - u michigan medical s

Re: [R] boot package question: sampling on factor, not row

2003-11-10 Thread Thomas W Blackwell
Scott - The second argument to boot(), called 'statistic', can be any user-written function you want to cook up, with additional arguments being passed to it through the '...' mechanism after all of the named arguments. (See: `R-intro `Writing your own functions `The ellipsis argument for det

Re: [R] plot w/o axes [was: predict.lm with (logical) NA vector]

2003-11-10 Thread Thomas W Blackwell
Ann - Maybe you are looking for plot( ..., xlab="", ylab="") followed by title(xlab="the real x axis label") title(ylab="the real y axis label", mgp=c(2.5,0.5,0)) This is a construction that I use all, all, all the time. - tom blackwell - u michigan medica

Re: [R] newbie's additional (probably to some extent OT) questions

2003-11-06 Thread Thomas W Blackwell
JB and Michael - I'm coming into this without having reviewed the earlier emails (if there are any) in this thread. But I will guess that the data come from a high school physics experiment on gravitational acceleration which drops a weight dragging a paper tape through a buzzer with a piece of

Re: [R] Ignoring Errors in Simulations

2003-11-05 Thread Thomas W Blackwell
Ken - Either test each simulated data set explicitly for the condition which causes factanal() to fail (perhaps rank deficiency ?), or else use try(). Which is quicker, using try() or restarting your simulation from the beginning each time there's a failure ? - tom blackwell - u michigan

Re: [R] read.spss Error reading system-file header

2003-11-04 Thread Thomas W Blackwell
; > It would be nice to know what exactly read.spss needs, though! > > Thanks again > > Jake > > On Tue, 4 Nov 2003, Thomas W Blackwell wrote: > > > Jake - > > > > The error message and warnign message shown below say something > > is wrong with this

Re: [R] read.spss Error reading system-file header

2003-11-04 Thread Thomas W Blackwell
Jake - The error message and warnign message shown below say something is wrong with this file's SPSS system-file header. If you are really able to open this one in SPSS, do so, change maybe a column name or row name or two, and save it again under a different file name. See if read.spss() cho

Re: [R] How to define a function to be smooth?

2003-11-04 Thread Thomas W Blackwell
Is this a homework assignment ? - tom blackwell - u michigan medical school - ann arbor - On Tue, 4 Nov 2003, Feng Zhang wrote: > Hey, R-listers > > When we say a function f(t) is smooth, does this mean that > f has infinite differentials with respect to t? > > Or any other formal definit

Re: AW: [R] R function help arranged in categorical order ?

2003-11-04 Thread Thomas W Blackwell
Neil - Maybe also the "Function and variable index", pages 94-96, and the "Concept index", pages 97-98 in "An Introduction to R", cran.r-project.org/doc/manuals/R-intro.pdf. - tom blackwell - u michigan medical school - ann arbor - On Tue, 4 Nov 2003, RINNER Heinrich wrote: > The

Re: [R] hclust doesn't return merge details

2003-11-03 Thread Thomas W Blackwell
Arne - I have carried out exactly your example below, and I get hc$merge as a matrix with two columns and 15 rows. Do str(hc) to see a useful representation of the contents of the returned list. help("hclust") describes this list in the section "Value:". help("Subscript") shows the various

[R] cannot have a function argument named 'break'

2003-11-02 Thread Thomas W Blackwell
Dear list - I just discovered to my surprise that I cannot define a function with an argument named 'break' or 'while'! 'breaks' is okay. Maybe this is no surprise to the R developers. R-1.7.1, 2003-06-16, i686-pc-linux-gnu. - tom blackwell - u michigan medical school - ann arbor - __

Re: [R] constrained OLS on coefficient

2003-10-29 Thread Thomas W Blackwell
Use lm() or glm() with argument 'offset' set to the value of the column whose coefficient must be 1. See help("lm"). - tom blackwell - u michigan medical school - ann arbor - On Wed, 29 Oct 2003, umeno wrote: > Hi, > > I would like to know if anyone has any idea of how to run an OLS wi

Re: [R] importing SAS data

2003-10-29 Thread Thomas W Blackwell
Paul - I think you have to have an executable copy of SAS on the same machine as R in order for this to work. I've never used it, but I remember a very similar question on the list from just a few months ago. Maybe there's some description of this in the foreign package manual, or in the help p

Re: [R] error message in simulation

2003-10-28 Thread Thomas W Blackwell
Yu-Kang - Simulations by their nature use randomly generated data. Sometimes the random data doesn't contain enough information to fully determine the parameter estimates for one iteration or another. It seems likely that that is what happened here. The design matrix is singular for one iteratio

Re: [R] outer function problems

2003-10-28 Thread Thomas W Blackwell
Scott - I agree with Spencer Graves that there's a scoping issue here: Where does function Dk() pick up the values for n0 and w, and does it get them from the SAME place when it's called from inside FindLikelihood() as from outside ? But more important is this one: All arithmetic on vect

Re: [R] expanding factor with NA

2003-10-27 Thread Thomas W Blackwell
Perhaps a much simpler method (just thought of it) would be to set options(na.action="na.pass") before you start. Or use na.action=na.pass() as an argument in the call to model.frame(), since that's where the problem begins. See help("na.omit"), help("model.frame"). - tom blackwell - u

Re: [R] expanding factor with NA

2003-10-27 Thread Thomas W Blackwell
I would re-expand the model matrix by indexing its (nobs) rows with a longer vector (of length n) containing the correspondence. If there is only one term (say "Z") in the formula which contains the problematic NAs, I would do (roughly) ff <- Y ~ Z# following the example in ?model.m

Re: [R] 2 D non-parametric density estimation

2003-10-22 Thread Thomas W Blackwell
John - My recollection is that Adrian Raftery's contributed package 'mclust' does kernel density estimation as well. Not sure whether it does what you need. Take a look at it on CRAN. Ah..I see that the description which shows up on Jon Baron's search page is not encouraging. Give it a try, a

Re: [R] nlm, hessian, and derivatives in obj function?

2003-10-18 Thread Thomas W Blackwell
Jeff - The function obj() which you define below is just a bit peculiar, since inside the function it assigns attributes to an object 'obj' with the same name as the *function* but which has not previously been defined inside the function. Is this really what you intended ? I'm not enough of

Re: Fw: [R] SIMCA algorithm implementation

2003-10-15 Thread Thomas W Blackwell
Mike - For predicting class membership, I would use either lda() or qda() from the MASS package. See the Venables and Ripley book for detailed description of the methods. You'll have to rely on your own references for what the 'SIMCA' algorithm actually does. I've never heard of it. Sounds

Re: [R] Trasparent graphs?

2003-10-14 Thread Thomas W Blackwell
Kenneth - Using base package graphics, use plot() on the first call, then either points() or lines() on subsequent calls to build up a single plot, layer by layer. Each call can use an argument col=... . However, the colors themselves are not transparent, AFAIK, so that where two symbols

RE: [R] Problem getting an ifelse statment to work

2003-10-07 Thread Thomas W Blackwell
Greg - I am puzzled that the total counts in table(qs2) and table(qs9) could be different, if these are in fact two columns from the same data frame. I'm guessing that there are NAs in one or both columns, in addition to the digits 1,2,3,4, and that table() by default does not show them. (

Re: [R] installation of R

2003-10-06 Thread Thomas W Blackwell
This is a question you should be able to answer from the R web site, www.r-project.org. - tom blackwell - u michigan medical school - ann arbor - On Mon, 6 Oct 2003, Stefanie Chau wrote: > I wish to install R on my computer but I do not > know how to do this. I have a Windows ME. > Please

Re: [R] visualizing transition probability matrices

2003-10-06 Thread Thomas W Blackwell
On Mon, 6 Oct 2003, Tamas Papp wrote: > I have a couple of (~200) 3x3 transition probability matrices (ie each > defines a Markov chain). They are all estimated from the same > underlying process, so it ie meaningful to take their elemetwise mean > and standard deviation. [1] > > First question: s

Re: [R] prcomp or princomp

2003-10-06 Thread Thomas W Blackwell
Ann - Some useful references are given in the help for each function. Please DO READ the help. - tom blackwell - u michigan medical school - ann arbor - On Mon, 6 Oct 2003, Ann Devitt wrote: > Hello, > is there any documentation on doing principal components analysis with R > besides the

Re: [R] polynomial fit

2003-10-06 Thread Thomas W Blackwell
Karim - try function gam() in package mgcv. library("mgcv") help("gam") - tom blackwell - u michigan medical school - ann arbor - On Mon, 6 Oct 2003, Karim Elsawy wrote: > I would like to fit a function H = F(x,y,z) but I do not know the > analytical expression > of H, is there a way

Re: [R] Apply and its friends

2003-10-06 Thread Thomas W Blackwell
Crispin - This is a familiar problem. The only way I know of to do it is: result <- lapply(seq(along=list.a), function(i,a,b) do.it(a[[i]], b[[i]]), list.a, list.b) Here, do.it() is the function which operates on two elements. I use this construction frequently. - tom blackwell - u mich

Re: [R] Creating survival object

2003-10-05 Thread Thomas W Blackwell
Jens - After reading Help("Surv"), yes, I think you have interpreted the two required arguments to Surv() correctly. I don't know of a ready-made function to do the transformation you illustrate. If I had to program it myself, I would use diff(), rep() and order(). - tom blackwell - u mic

Re: [R] (no subject)

2003-10-04 Thread Thomas W Blackwell
Silika - By far the best reference for the nlme package is the book by its authors: J.C. Pinheiro and D.M. Bates. Mixed effects models in S and Splus. Springer, NY, 2000. ISBN (US) 0-387-989579. (There is a different, European, ISBN number but my library catalog doesn't give it.) This citati

Re: [R] Query: weighting cells in histogram

2003-10-03 Thread Thomas W Blackwell
nd not the actual observataions (which I don't have). However, that's > not how 'x' is specified. > > Thank you again, > > Mårten > > - Original Message - > From: "Thomas W Blackwell" <[EMAIL PROTECTED]> > To: "Mårten Bjel

Re: [R] Query: weighting cells in histogram

2003-10-02 Thread Thomas W Blackwell
Marten - I don't know exactly what interpretation you have in mind for weights, but if you assign the value of hist() to a variable tmp, you can then assign the component tmp$counts any value you like, and plot the result as a histogram using plot(tmp). See the section "Value:" in help("his

Re: [R] multi-dimensional hash

2003-10-02 Thread Thomas W Blackwell
Arne - In the past, I've used a data frame for the lookup table and the "and" of individual logical vectors to select rows from it. Here's a simplified version of the selector function I wrote. My mail editor does not balance parentheses, so I don't guarantee that this version is syntactically co

Re: [R] Solving a tridiagonal system

2003-10-01 Thread Thomas W Blackwell
Will - Take a look at Roger Koenker's package SparseMatrix, available from CRAN. Look also for some other package from Roger which depends on SparseMatrix, but has a different name. It's a place to look. I don't recall whether it will answer your need or not. - tom blackwell - u michigan

Re: [R] subsetting a matrix

2003-09-30 Thread Thomas W Blackwell
Rajarshi - Why not simply subscript your matrix X to return the rows and columns you want to keep ? For example, new <- X[16:176, c(3,5,7,9)] assuming those are the rows and columns you want. See help("Extract"). - tom blackwell - u michigan medical school - ann arbor - On Tue, 30 Sep

Re: [R] Data frame transpose

2003-09-29 Thread Thomas W Blackwell
Dave - I'm not sure whether there is already a function which does exactly what you want, because this is kind of a special case. The functions I wold look at are: "by", "aggregate", "tapply", "mapply", and, in the package "nlme" one I didn't know about before called "gapply". But, in your case,

Re: [R] frustration with ave()

2003-09-28 Thread Thomas W Blackwell
Maintainers - I should have said I am running R 1.7-1 on RedHat Linux 8.0. - tom blackwell - u michigan medical school - __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Re: [R] frustration with ave()

2003-09-28 Thread Thomas W Blackwell
Ed - You seem to have encountered a bug. I can reproduce Ed's difficulty in a completely artificial example in which there are unused levels : tmp <- factor(rep(seq(10), seq(10))) # length(tmp) # [1] 55 ave(seq(50), tmp[-seq(5)]) # gives NA in rows 32-50 I would consider th

Re: [R] performance question

2003-09-26 Thread Thomas W Blackwell
Axel - I believe that a function argument is not literally copied until the first time it is modified within the function. See email exchanges on this list from/to Ross Boylan within the month of September for a more authoritative answer to this question. (Do you know about the R-help archives a

Re: [R] empty postscript output of figures

2003-09-26 Thread Thomas W Blackwell
Andreas - help("postscript") says: "Arguments: file: ... For use with 'onefile=FALSE' give a 'printf' format such as `"Rplot%03d.ps"' (the default in that case)." The "%03d" will be replaced with a three digit number in the actual file name. This allows postscript() to generate a distin

Re: [R] apply on a 4D array

2003-09-25 Thread Thomas W Blackwell
Ben - I think you want something like new <- array(prod(hiaAry, probAry[,,,1], probAry[,,,2], probAry[,,,3], probAry[,,,4]), dim(hiaAry)) But I'm just guessing. - tom blackwell - u michigan medical school - ann arbor - On Thu, 25 Sep 2003 [EMAIL PROTECTED] wrote: > I am tryi

Re: [R] ungrouping grouped data

2003-09-25 Thread Thomas W Blackwell
Michael - new <- as.data.frame(lapply(data, function(x,p) rep(x,p), data[["frequency"]])) This should do it. The first paragraph under "Details" in help("rep") says what rep(x,p) is doing above. The rest is just hardware to apply that to every column in your existing data frame, and turn t

Re: [R] using assign on save?

2003-09-24 Thread Thomas W Blackwell
Andy - help("assign") says: "Value: This function is invoked for its side effect, which is assigning `value' to the variable `x'. ..." Gosh. The help page isn't very specific about what the return value of assign() IS, but it's not a named object. Your basic strategy of assigning, writin

Re: [R] discretization method

2003-09-23 Thread Thomas W Blackwell
On Tue, 23 Sep 2003, Jaime Lopez Carvajal wrote: > I need to apply discretization to my continuous data. > Is there a method in R to do this? See help("cut"). - tom blackwell - u michigan medical school - ann arbor - __ [EMAIL PROTECTED] maili

Re: [R] Saving with tkgetSaveFile

2003-09-19 Thread Thomas W Blackwell
Ruben - Why not simply save(x, file="new.file.name") ? See help("save"), help("files"). The file name must be quoted, and it must be passed as a named argument to save(). - tom blackwell - u michigan medical school - ann arbor - On Fri, 19 Sep 2003 [EMAIL PROTECTED] wrote: > HI, i'

Re: [R] list subsets & passing parameters question.

2003-09-19 Thread Thomas W Blackwell
Eryk - Question 1: Square brackets work, just the same as for vectors, and return a (smaller or larger) list object. The new thing with lists, not available (or needed) with vectors, is double square brackets, which return one list element as itself, not enclosed in a list. See help("Subscript"

Re: [R] R-1.7.1 package installation problem

2003-09-18 Thread Thomas W Blackwell
Rong - I think you want the www.bioconductor.org site. - tom blackwell - u michigan medical school - ann arbor - __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Re: [R] 3D plot/surface rotation

2003-09-17 Thread Thomas W Blackwell
Perhaps MZodet wants the interactive, mouse controlled rotation capability offered by ggobi ? Designed for linux but advertises "better portability to Microsoft Windows". I have no experience myself either installing or using this. - tom blackwell - u michigan medical school - ann arbor -

Re: [R] can predict ignore rows with insufficient info

2003-09-16 Thread Thomas W Blackwell
On Tue, 16 Sep 2003, Peter Whiting wrote: > It seems that predict removes rows with insufficient information > (ie, if I replace "ALBANY" with NA and refactor everything works) > - I wonder why it doesn't exhibit the same behavior when it > encounters a new level - just eliminate the row and go

Re: [R] can predict ignore rows with insufficient info

2003-09-16 Thread Thomas W Blackwell
Peter - Error !! I forgot a "not" in the third line inside the function supported(). And, my mail editor doesn't balance parentheses, so I don't guarantee that my code is even syntatically correct. Corrected and re-named version of function: unsupported <- function(i,y,d) { result <- rep(F,

Re: [R] can predict ignore rows with insufficient info

2003-09-16 Thread Thomas W Blackwell
Peter - Your subsequent email seems just right. You have to determine ahead of time which rows can be estimated. Here's a strategy, and possibly some code to implement it. Let supported(i,y,d) be a user-written function which returns a logical vector indicating rows which should be omitted f

[R] help("print") seems truncated

2003-09-16 Thread Thomas W Blackwell
Dear r-help - I just noticed that in my R-1.7.1 on i386-pc-linux-gnu, the page displayed by help("print") ends with the line " ## Printing of factors illustrated for ex" and then no more. It looks as though something got truncated here. I think this is an R that I compiled from source o

Re: [R] Retrieve ... argument values

2003-09-16 Thread Thomas W Blackwell
Huan - Look at the function code for order(). To show the function definition, type just order at the command line (no quotes, no parentheses). This example is what I found most useful when I had a similar question. The green book is also useful. - tom blackwell - u michigan medical schoo

Re: [R] what does this error mean?

2003-09-13 Thread Thomas W Blackwell
Josh - See the example "run a simulation" in help("try"). This won't be able to tell you the Spearman correlation when there are fewer than two pairs of non-missing values, but it will allow the loop to keep running. Caution: the return value from try() will be a string with the error messag

Re: [R] converting dataframe columns to vector and missing values

2003-09-12 Thread Thomas W Blackwell
On Fri, 12 Sep 2003, Spencer Graves wrote: > Have you considered: > > x <- Data[!is.na(Data[,n]), n] > > Does this do what you want? Vectors, arrays, and data.frame can be > indexed by number or by a logical vector -- and by names if such are > supplied. In this case, "!is.na(Data[,n])"

Re: [R] dataframe subsetting

2003-09-10 Thread Thomas W Blackwell
Ryan - Puzzling. My best guess is a misspelling or a truncation in the column name "intent" within latdata in the context of > unlikely <- latdata[latdata$intent %in% c(1,2,3,4),] but I do not see any such misspelling in your email. Could you try again, using some other way to specify the col

Re: [R] Need your help-SOS

2003-09-10 Thread Thomas W Blackwell
WeiQiang - As I read it, both difficulties arise on the DCOM side, not in the R syntax. Problem 1, and I'm just guessing, could arise if you are not allowed to overwrite the value of "Result" in the DCOM environment. Try again, using two different variable names in the two successive lines. Pr

Re: [R] memory problem in exporting data frame

2003-09-08 Thread Thomas W Blackwell
Simplest is to save your workspace using save.image(), then delete a bunch of large objects other than the data frame that you want to export, and run write.table() again, now that you've made space for it. A quick calc shows 17000 x 400 x 8 = 55 Mb, and that's just the size of the object that

Re: [R] How do I coerce numeric factor columns of data frame to vector?

2003-09-08 Thread Thomas W Blackwell
Michael - Because these columns are factors to begin with, using as.numeric() alone will have unexpected results. See the section "Warning:" in help("factor"). However, it is worth Murray asking himself WHY these columns are factors to start with, rather than the expected numeric values. One f

Re: [R] How do I coerce numeric factor columns of data frame to vector?

2003-09-08 Thread Thomas W Blackwell
Murray - Suppose your data frame is called mydata. If ALL of the columns were factors with numeric levels, you could do: newdata <- as.data.frame(lapply(mydata, function(x) as.numeric(as.character(x (Sorry about the nested functions. I didn't invent these complications.) When only the co

Re: [R] stack overflow

2003-09-05 Thread Thomas W Blackwell
Bill - Here's what I would do, starting after your display of anovaresults[[1]]. temp.1 <- unlist(lapply(anovaresults, function(x) { x["Pr(>F)"][1:3],] })) temp.2 <- matrix(temp.1, length(anovaresults), 3, byrow=T) dimnames(temp.2) <- list(names(anovaresults), dimnames(

  1   2   >