[R] possible bug with largest.cliques in igraph_0.6-3

2012-10-31 Thread Christos Hatzis
grDevices utils datasets methods base other attached packages: [1] igraph_0.5.5-3 Thanks. Christos Hatzis, Ph.D. Nuvera Biosciences, Inc. 999 Broadway, Suite 301 Saugus, MA 01906 __ R-help@r-project.org mailing list https

Re: [R] remove object

2009-05-29 Thread Christos Hatzis
You can try rm(list = ls()[!(ls() %in% index)]). -Christos -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Luc Villandre Sent: Friday, May 29, 2009 2:06 PM To: fernando espindola Cc: r-help@r-project.org Subject: Re: [R]

[R] functions flagged for debugging

2009-03-27 Thread Christos Hatzis
Hi, Is there a way to find which functions are flagged for debugging in a given session? Thank you. -Christos [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] Statistical Tests

2009-03-20 Thread Christos Hatzis
The following site is your friend: http://www.rseek.org/ -Christos -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of meenu.s...@ingim.com Sent: Friday, March 20, 2009 5:47 AM To: r-help@r-project.org Subject: [R]

Re: [R] set size of a plot

2009-03-12 Thread Christos Hatzis
See ?pdf and its width and height arguments. Also if you want to have the graph centered on a standard page, there are additional arguments to help you achieve that effect: pdf(test.pdf, height=5, width=5, paper=letter, pagecentre=TRUE) hist(rcauchy(100)) dev.off() -Christos -Original

Re: [R] Sparse PCA in R

2009-03-10 Thread Christos Hatzis
Take a look at the elasticnet package. -Christos -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of joris meys Sent: Tuesday, March 10, 2009 3:43 PM To: R-help Mailing List Subject: [R] Sparse PCA in R Dear all, I would

Re: [R] popular R packages

2009-03-10 Thread Christos Hatzis
Bioconductor already provides download stats for all packages... http://bioconductor.org/packages/stats/bioc/affy.html -Christos -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Max Kuhn Sent: Tuesday, March 10, 2009 12:25 PM

Re: [R] FW: flow control

2009-03-04 Thread Christos Hatzis
Hi Ken, The help page for ?for says that: The index seq in a for loop is evaluated at the start of the loop; changing it subsequently does not affect the loop. The variable var has the same type as seq, and is read-only: assigning to it does not alter seq. So you cannot do what you want to do

Re: [R] Linear Discriminant Analysis

2009-02-25 Thread Christos Hatzis
Maybe as a starter RSiteSearch(linear discriminant analysis) R has tools to help you help yourself with this types of questions. -Christos -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Arup Sent: Wednesday, February 25,

Re: [R] Using gregexpr with multiple search elements

2009-02-25 Thread Christos Hatzis
gregexpr(\\at|\\og, text) -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Corey Sparks Sent: Wednesday, February 25, 2009 11:50 AM To: R Help Subject: [R] Using gregexpr with multiple search elements Dear list, I am

Re: [R] how to NULL multiple variables of a df efficiently?

2009-02-24 Thread Christos Hatzis
Setting to NULL works only if a single column is selected. More generally, df[, !(colnames(df) %in% c(var.b, var.c)), drop=FALSE] -Christos -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Sean Zhang Sent: Tuesday, February

Re: [R] how to NULL multiple variables of a df efficiently?

2009-02-24 Thread Christos Hatzis
You're right. The help page is somewhat misleading at first read. ?`[-.data.frame` states that (with added emphasis) value A suitable replacement value: it will be repeated a whole number of times if necessary and it may be coerced: see the Coercion section. *** If NULL, deletes the column if

Re: [R] trade-off between speed and storage in matrix multiplications

2009-02-23 Thread Christos Hatzis
You might want to compare the performance of your version to the kronecker method of Matrix (Matrix package) that has appropriate versions for sparse matrices etc. -Christos -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of

Re: [R] Formula that includes previous row values

2009-02-23 Thread Christos Hatzis
Here's a way without a loop: x - read.table(textConnection(ID X2 1.001.00 2.000.00 3.001.00 4.003058 5.000.00 6.006.00),header=TRUE) closeAllConnections() x$X3 - append(x$X2, 0, 0)[-nrow(x)] x$X4 - as.matrix(x[,2:3]) %*% c(1, 0.24) x ID X2 X3 X4 1 1

Re: [R] Source code for nlm()

2009-02-19 Thread Christos Hatzis
It seems to be in optimize.c Rgonzui has a very nice search facility for source of R or CRAN packages (however it is against R 2.8.0 source): http://rgonzui.nakama.ne.jp/R/markup/R-2.8.0/src/main/optimize.c?fm=cq=nlm# l378 -Christos -Original Message- From:

Re: [R] how to perform power analysis and sample sizeestimation/projection using R

2009-02-12 Thread Christos Hatzis
Ok. So you have a set of features, which when combined in a certain way predict a binary outcome, i.e. a multi-feature binary predictor. You have to decide first what is the hypothesis that you want to test regarding this predictor in the study that you're designing. E.g. that prediction

Re: [R] Aggregrate function

2009-02-12 Thread Christos Hatzis
I don't have an easy solution with aggregate, because the function in aggregate needs to return a scalar. But the following should work: do.call(rbind, lapply(split(xveg, xveg$loc), function(x) x[which.max(x$tot), ])) loc sp tot L1 L1 b 60 L2 L2 e 30 L3 L3 b 68 -Christos

Re: [R] Aggregrate function

2009-02-12 Thread Christos Hatzis
This requires a small modification to use which instead of which.max that returns only the first maximum: do.call(rbind, lapply(split(xveg, xveg$loc), function(x) x[which(x$tot == max(x$tot)), ])) loc sp tot L1L1 b 60 L2.5 L2 d 25 L2.7 L2 e 25 L3L3 b 68 -Christos

Re: [R] Efficent way to create an nxn upper triangular matrix of one's

2009-02-11 Thread Christos Hatzis
Here is a way to do this: round(upper.tri(matrix(1, 9, 9))) Or if you also need the diagonal of one's round(upper.tri(matrix(1, 9, 9), diag = TRUE)) -Christos -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Dale Steele

Re: [R] Choosing a random number between x and y

2009-02-09 Thread Christos Hatzis
If you want to chose numbers from your range with uniform probability runif(1, 0, 0.5) See ?runif -Christos -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Vie Sent: Monday, February 09, 2009 9:41 AM To:

Re: [R] Generating new variable based on values of an existing variable

2009-02-09 Thread Christos Hatzis
One way to do this is through transform, assuming that there is one-to-one correspondence between regions and elements: mydf - data.frame(region=c(rep(North, 5), rep(East, 5), rep(South, 5), rep(West, 5))) elements - c(earth, water, air, fire) transform(mydf, element = factor(region,

Re: [R] meaning of asymmetric on help page for intersect

2009-01-13 Thread Christos Hatzis
... which is the same as setdiff(union(x, y), intersect(x, y)) -Christos -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of dav...@rhotrading.com Sent: Tuesday, January 13, 2009 10:56 AM To: Juliet Hannah;

Re: [R] extract the digits of a number

2008-12-09 Thread Christos Hatzis
An alternative that works for any base (other than 10) is the following: library(sfsmisc) digitsBase(1001, 10) Class 'basedInt'(base = 10) [1:1] [,1] [1,]1 [2,]0 [3,]0 [4,]1 -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On

Re: [R] Save a function existing library

2008-10-30 Thread Christos Hatzis
A simple approach would be to start a fresh R session and source your function. Then save that workspace as, e.g., myFuncs.RData. In future sessions all you have to do is attach(myFuncs.Rdata) and your functions will be available for you to use. -Christos -Original Message- From:

Re: [R] Barplot: Vertical bars with long labels

2008-10-29 Thread Christos Hatzis
Udo, You can try inserting a newline where you need the break in your labels: dd.names - c('Conduct Disorders','Attention Deficit', 'Eating Disorders', 'Substance Abuse','Developmental Disorders') dd.names.2 - sapply(dd.names, function(x) gsub(\\s, \\\n, x)) barplot(dd, names.arg=dd.names.2)

Re: [R] using ifelse with surprising results

2008-10-17 Thread Christos Hatzis
Try the following instead: vegdata.dd[is.na(vegdata.dd)] - 0.01 -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Friday, October 17, 2008 4:50 PM To: [EMAIL PROTECTED] Subject: [R] using ifelse with surprising

Re: [R] Loop avoidance in simulating a vector

2008-10-16 Thread Christos Hatzis
Have a look at mapply. -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Afshartous Sent: Thursday, October 16, 2008 3:47 PM To: r-help@r-project.org Subject: [R] Loop avoidance in simulating a vector All, I'd like to

Re: [R] Loop avoidance in simulating a vector

2008-10-16 Thread Christos Hatzis
hidden interpreted loops). -- Bert Gunter -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Christos Hatzis Sent: Thursday, October 16, 2008 1:06 PM To: 'David Afshartous'; r-help@r-project.org Subject: Re: [R] Loop avoidance in simulating

Re: [R] R book needed

2008-10-09 Thread Christos Hatzis
You might find Robert Gentleman's recent book useful for exposure on many of the more advanced features of R. http://www.bioconductor.org/pub/RBioinf/ -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hua Li Sent: Thursday, October 09,

Re: [R] Using grep

2008-10-08 Thread Christos Hatzis
which(A %in% B) -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of mentor_ Sent: Wednesday, October 08, 2008 11:19 AM To: r-help@r-project.org Subject: [R] Using grep Hi, I have a vector A with (200, 201, 202, 203, 204, ... 210)

Re: [R] vectorized sub, gsub, grep, etc.

2008-10-07 Thread Christos Hatzis
John, Try the following: mapply(function(p, r, x) sub(p, r, x, fixed = TRUE), p=patt, r=repl, x=X) b cda aB CD ef -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Thaden, John J Sent: Tuesday, October 07, 2008 3:59 PM To:

Re: [R] algorithm to create unique identifiers

2008-09-04 Thread Christos Hatzis
It might be an overkill for what you need, but take a look at package Ruuid. -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ralph S. Sent: Thursday, September 04, 2008 11:44 PM To: r-help@r-project.org Subject: [R] algorithm to create

Re: [R] sequence with start and stop positions

2008-08-26 Thread Christos Hatzis
Try: unlist(mapply(seq, c(1,20,50), c(7,25,53))) [1] 1 2 3 4 5 6 7 20 21 22 23 24 25 50 51 52 53 -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris Oldmeadow Sent: Tuesday, August 26, 2008 12:42 AM To: r-help@r-project.org

Re: [R] paste: multiple collapse arguments?

2008-08-25 Thread Christos Hatzis
Try this: paste(paste(x, c( ,\n), sep=), collapse=) [1] 1 2\n3 4\n5 6\n -Christos Hatzis -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of remko duursma Sent: Monday, August 25, 2008 7:37 PM To: r-help@r-project.org Subject: [R] paste: multiple

Re: [R] simple generation of artificial data with defined features

2008-08-22 Thread Christos Hatzis
), bw.dt$Freq), -ncol(bw.dt)] dim(bw.dt.exp) [1] 200 2 table(bw.dt.exp) Var2 Var1 B Bb A 10 40 Ab 15 135 The above approach is not restricted to 2x2 tables, and should be straightforward generate datasets that conform to arbitrary nxm frequency tables. -Christos Hatzis

Re: [R] conditional with and operators

2008-08-19 Thread Christos Hatzis
Mark, It is not clear whether you are dealing with a single list or something more complex, such as a list of lists or a list of data frames. In the case of a single list, you don't really need any of the 'apply' functions. The main problem in your code is the use of '' instead of '': test.1

Re: [R] Opening a web browser from R?

2008-08-15 Thread Christos Hatzis
Jose, I think shell.exec should do what you want: shell.exec(http://www.yahoo.com;) -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Friday, August 15, 2008 6:56 AM To: r-help@r-project.org Subject: [R]

Re: [R] help with my sloppy syntax

2008-08-14 Thread Christos Hatzis
Would something like this work? my.list - as.list(c(NIM.results$par, a.hat.decision, etc)) do.call(Draw.NIM.POD.curve, my.list) -Christos Hatzis -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charles Annis, P.E. Sent: Thursday, August 14, 2008 11

Re: [R] correlation between rows of data.frame

2008-08-01 Thread Christos Hatzis
Eleni, A way to do this is to group the data first using 'split' and then sapply the dist function to this list. The slower step will be the split which took a couple of minutes on my laptop but sapply should not take more than a minute or so. size - 1 df - data.frame(

Re: [R] Grouping Index of Matrix Based on Certain Condition

2008-07-31 Thread Christos Hatzis
Try this: x - matrix(runif(20), ncol=2) x [,1] [,2] [1,] 0.33119833 0.4797847 [2,] 0.01339784 0.5218626 [3,] 0.78975940 0.8597246 [4,] 0.60849015 0.5217248 [5,] 0.91779777 0.9364047 [6,] 0.88302538 0.3467961 [7,] 0.87565986 0.4029147 [8,] 0.51594479 0.9885018 [9,]

Re: [R] cutting out numbers from vectors

2008-07-31 Thread Christos Hatzis
Have a look at gsub: x - 001-010-001-0 gsub(^0+, , x) [1] 1-010-001-0 -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of calundergrad Sent: Thursday, July 31, 2008 4:40 PM To: r-help@r-project.org Subject: [R] cutting out numbers from

Re: [R] john chambers R book

2008-07-30 Thread Christos Hatzis
I just received mine today (had pre-ordered it directly from Springer) -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, July 30, 2008 2:27 PM To: r-help@r-project.org Subject: [R] john chambers R book

Re: [R] finding a faster way to do an iterative computation

2008-07-29 Thread Christos Hatzis
matrix(rep(x, each=13) - xk, nrow=13) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of dxc13 Sent: Tuesday, July 29, 2008 2:13 PM To: r-help@r-project.org Subject: [R] finding a faster way to do an iterative computation useR's, I am trying

Re: [R] Fill in NA values in vector with previous character/factor

2008-07-28 Thread Christos Hatzis
-Christos Christos Hatzis, Ph.D. Nuvera Biosciences, Inc. 400 West Cummings Park Suite 5350 Woburn, MA 01801 Tel: 781-938-3830 www.nuverabio.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bert Gunter Sent: Monday, July 28, 2008 4:05 PM

Re: [R] split character string in matrix into character vector and numeric vector

2008-05-21 Thread Christos Hatzis
x - B03_MAH 0.2115 0.2087 0.2087 0.2147 0.2115 0.2176 strsplit(x, +) [[1]] [1] B03_MAH 0.2115 0.2087 0.2087 0.2147 0.2115 0.2176 -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kim Milferstedt Sent: Wednesday, May 21,

Re: [R] A very simple question

2008-05-14 Thread Christos Hatzis
k - c(1,1,1,2,2,1,1,1) k[k != 1] [1] 2 2 k[k != 2] [1] 1 1 1 1 1 1 k[k != 3] [1] 1 1 1 2 2 1 1 1 -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Wednesday, May 14, 2008 11:16 AM To: [EMAIL

Re: [R] data transformation

2008-05-02 Thread Christos Hatzis
Christian, You need to use reshape to convert to the 'long' format. Check the help page ?reshape for details. dat - read.table('clipboard', header=TRUE) dat site lat lon spec1 spec2 spec3 spec4 1 site1 10 11 1 0 1 0 2 site2 20 21 1 1 1 0 3 site3 30 31

Re: [R] help with subset

2008-05-02 Thread Christos Hatzis
Try %in% subset(dat, treatment %in% vec) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Friday, May 02, 2008 11:41 PM To: r-help@r-project.org Subject: [R] help with subset Dear list: I have a problem using the

Re: [R] elseif syntax

2008-05-01 Thread Christos Hatzis
Another option in R is to use the vectorized version 'ifelse', which has an advantage if x is a vector: x - -1:4 x [1] -1 0 1 2 3 4 ifelse(x == 1, 'same', ifelse(x 1, 'bigger', 'smaller')) [1] smaller smaller samebigger bigger bigger -Christos -Original Message- From:

Re: [R] Design and analysis of mixture experiments

2008-04-17 Thread Christos Hatzis
The place to look is the CRAN Task View 'ExperimentalDesign'. There are several packages there related to design and analysis of experiments. The package 'AlgDesign' appears to have a function for generating mixture designs, and there might be others in other packages. Good luck! -Christos

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] Rule for accessing attributes?

2008-03-27 Thread Christos Hatzis
Mar 2008, Christos Hatzis wrote: You need to use the '@' operator to directly access attributes (not elements) of objects: [EMAIL PROTECTED] [1] x y z See ?'@' for more details. -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED

Re: [R] A faster way to compute finite-difference gradient of a scalarfunction of a large number of variables

2008-03-27 Thread Christos Hatzis
Here is as solution that calculates derivatives using central differences by appropriately embedding the vectors: grad.1 function(x, fn) { x - sort(x) x.e - head(embed(x, 2), -1) y.e - embed(fn(x), 3) hh - abs(diff(x.e[1, ])) y.e - apply(y.e, 1, function(z) (z[1] - z[3])/(2 * hh))

Re: [R] peak finding

2008-03-24 Thread Christos Hatzis
John, There is a peak finding algorithm attributed to Prof. Ripley in the R-help archive. It has a span parameter which might give you something close to what you seem to be looking for. http://finzi.psych.upenn.edu/R/Rhelp02a/archive/33097.html -Christos -Original Message- From:

Re: [R] a more elegant way to get percentages?

2008-03-13 Thread Christos Hatzis
Monica, You can try the following: x.tot - aggregate(x$val, by=list(total=x$locat), 'sum') x.tot total x 1 a 5 2 b 20 3 c 40 4 d 30 cbind(x, perc=x$val/rep(x.tot$x, table(x$locat)) * 100) locat val perc 1 a 5 100.0 2 b 5 25.0 3 b 15

Re: [R] subset list based on logical within element flag

2008-03-12 Thread Christos Hatzis
Try: names(which(my_list == 'Fred')) [1] name You can break down the two nested calls to figure out what is happening. -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Srinivas Iyyer Sent: Wednesday, March 12, 2008 6:53 PM To: Benilton

Re: [R] regular expressions

2008-03-12 Thread Christos Hatzis
Try this one: gsub(^(plif)([a-z]*), \\1ONE, words) [1] plifONE plafboum ploufbang plifONE -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of GOUACHE David Sent: Wednesday, March 12, 2008 12:15 PM To: [EMAIL PROTECTED] Subject: [R]

Re: [R] compress data on read, decompress on write

2008-02-28 Thread Christos Hatzis
Ramon, If you are looking for a solution to your specific application (as opposed to a general compression/ decompression mechanism), it might be worth checking out the Matrix package, which has facilities for storing and manipulating sparse matrices. The sparseMatrix class stores matrices in

Re: [R] 2D kolmogorov

2008-02-27 Thread Christos Hatzis
Googling MUAC mentioned in that message will take you to the following site with information on the algorithm and apparently access to the code. http://www.acooke.org/jara/muac/index.html -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of

Re: [R] Plot Principal component analysis

2008-02-26 Thread Christos Hatzis
If your samples are in the specified order (i.e. first 100 from group A and remaining from group B) you can try the following in your plot call: plot(..., col=c(red, blue)[c(rep(100, 1), rep(15, 2))]) -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On

Re: [R] Plot Principal component analysis

2008-02-26 Thread Christos Hatzis
Sorry, it should have been: col = c(red, blue)[c(rep(1, 100), rep(2, 15))] -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Christos Hatzis Sent: Tuesday, February 26, 2008 4:46 PM To: 'SNN'; r-help@r-project.org Subject: Re: [R] Plot

Re: [R] immediate print

2008-02-05 Thread Christos Hatzis
Introduce cat(j) flush.console() in your loop. -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Waterman, DG (David) Sent: Tuesday, February 05, 2008 11:20 AM To: r-help@r-project.org Subject: [R] immediate print Hi everyone,

Re: [R] pivot table in R

2008-01-29 Thread Christos Hatzis
Also, see ?aggregate: with(A, aggregate(no_of_accidents, by=list(SEX=sex), FUN='sum')) SEX x 1 F 34 2 M 83 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Attiglah, Mama Sent: Tuesday, January 29, 2008 7:21 AM To: [EMAIL PROTECTED];

Re: [R] Function for translation of a list into a matrix as used byordination?

2008-01-25 Thread Christos Hatzis
Take a look at ?reshape - it is used to convert between 'long' and 'wide' formats of data tables (frames). -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Friday, January 25, 2008 4:30 PM To:

Re: [R] Displaying trailing zeroes

2008-01-24 Thread Christos Hatzis
formatC(round(12.01), digits=1, format=f) -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lucke, Joseph F Sent: Thursday, January 24, 2008 4:37 PM To: r-help@r-project.org Subject: [R] Displaying trailing zeroes round(12.01,1) will

Re: [R] if statement problem

2008-01-01 Thread Christos Hatzis
You need to use '' instead of '': A shorter version of your code using ifelse: das$danger - with(das, ifelse(age65 bmi30, 1, 0)) HTH -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gerard Smits Sent: Tuesday, January 01, 2008 5:04 PM

Re: [R] Recursive solution with for()

2007-12-20 Thread Christos Hatzis
It not entirely clear, but I think that you are looking for seq(t-1, 1) -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Owe Jessen Sent: Thursday, December 20, 2007 1:29 PM To: [EMAIL PROTECTED] Subject: [R] Recursive solution with

[R] book on regular expressions

2007-12-11 Thread Christos Hatzis
Hello, Could someone recommend a good book on regular expressions with focus on applications/use as it might relate to R. I remember there was a mention of such a reference book recently, but I could not locate that message on the archive. Thanks. -Christos Christos Hatzis, Ph.D. Nuvera

Re: [R] book on regular expressions

2007-12-11 Thread Christos Hatzis
Securities, LLC -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Christos Hatzis Sent: Tuesday, December 11, 2007 9:47 AM To: r-help@r-project.org Subject: [R] book on regular expressions Hello, Could someone recommend a good book on regular

Re: [R] vector sprintf argument

2007-11-29 Thread Christos Hatzis
According to the help page sprintf will recycle its arguments: The arguments (including fmt) are recycled if possible a whole number of times to the length of the longest, and then the formatting is done in parallel. Therefore the following works: sprintf(Number: %d, A) [1] Number: 3 Number:

Re: [R] The reverse of do.call(rbind,) on a list

2007-11-12 Thread Christos Hatzis
Try split: x - matrix(letters[1:4], 2) x [,1] [,2] [1,] a c [2,] b d split(x, row(x)) $`1` [1] a c $`2` [1] b d -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Søren Højsgaard Sent: Monday, November 12, 2007 8:08 PM To:

Re: [R] wrapper for coxph with a subset argument

2007-11-09 Thread Christos Hatzis
The following variation of what you proposed will allow you to either subset the dataset outside coxph or to use the subset argument: subwrap5 - function(x, sb=NULL) { coxph(Surv(times,event)~trt, data = x, subset = sb) } subwrap5(testdf, testdf$sex == 'F') subwrap5(testdf[testdf$sex == 'F',

Re: [R] wrapper for coxph with a subset argument

2007-11-09 Thread Christos Hatzis
In terms of recommended approach, I think it would be easier to generate subsetting conditions as (lists of) logical vectors and use those as suggested before. It seems to me more cumbersome to use the data to generate logical conditions as text strings and then parse those within your wrapper to

Re: [R] scoping problem

2007-10-24 Thread Christos Hatzis
Another way to do this without messing with environments is to update the data and formula locally within the function and re-run the regression on the updated model/data: tukey.test - function(m) { ud - data.frame( m$model, pred2=m$fitted.values^2 ) uf - update.formula(formula(m$terms),

Re: [R] functions applied to two vectors

2007-10-23 Thread Christos Hatzis
a - c(2, 3, 7, 5) b - c(4, 7, 8, 9) mapply(seq, from=a, to=b) -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rolf Turner Sent: Tuesday, October 23, 2007 11:29 PM To: Anya Okhmatovskaia Cc: r-help@r-project.org Subject: Re: [R]

Re: [R] Visualize cox proportional hazards

2007-10-10 Thread Christos Hatzis
). -Christos -Original Message- From: Armin Goralczyk [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 10, 2007 7:27 AM To: [EMAIL PROTECTED] Cc: R-help@r-project.org Subject: Re: [R] Visualize cox proportional hazards On 10/9/07, Christos Hatzis [EMAIL PROTECTED] wrote

Re: [R] Visualize cox proportional hazards

2007-10-09 Thread Christos Hatzis
There are at least a couple of versions of such plots. Search for forest plots: help.search(forest plot) -Christos Christos Hatzis, Ph.D. Nuvera Biosciences, Inc. 400 West Cummings Park Suite 5350 Woburn, MA 01801 Tel: 781-938-3830 www.nuverabio.com -Original Message- From