[R] Average regions of non-zeros

2010-03-07 Thread Daren Tan
x - c(0,0,1,2,3,0,0,4,5,6) How to identify the regions of non-zeros and average c(1,2,3) and c(4,5,6) to get 2 and 5. Thanks _ Hotmail: Trusted email with Microsoft¡¯s powerful

[R] Subsetting a vector of numerics such that standard deviation is less than 0.5 ?

2009-04-21 Thread Daren Tan
set.seed(999) abs(rnorm(20)) [1] 0.28174016 1.31255963 0.79518398 0.27007049 0.27730642 0.56602374 1.87865826 1.26679114 0.96774968 1.12100936 1.32546371 0.13397739 0.93874945 [14] 0.17253810 0.95765045 1.36268625 0.06833513 0.10065765 0.90134475 2.07435711 v - abs(rnorm(20)) v [1] 1.2285633

[R] Turning off warnings from cor.test

2009-04-17 Thread Daren Tan
I would like to turn off the warnings from cor.test while retaining exact=NULL. Is that possible ? cor.test(c(1,2,3,3,4,5), c(1,2,3,3,4,5), method = spearman) Spearman's rank correlation rho data: c(1, 2, 3, 3, 4, 5) and c(1, 2, 3, 3, 4, 5) S = 0, p-value 2.2e-16 alternative

[R] geometric mean to handle large number and negative values

2009-04-15 Thread Daren Tan
I have created two functions to compute geometric means. Method 1 can handle even number of negative values but not large number, vice versa for method 2. How can I merge both functions so that both large number and negative values can be handled ? geometric.mean1 - function(x)

[R] Colour each letter of a text string in a plot

2009-04-08 Thread Daren Tan
I am inserting a DNA sequence into a plot, and hope to colourize each of the four nucleotide of the DNA sequence with a unique colour i.e., A (red), C (green), G (blue, and T (yellow). I use the following codes, but the DNA sequence only shows as red DNA - ACGT plot(1, xlim = c(0,1), ylim =

Re: [R] line argument in mtext for axis ?

2009-04-06 Thread Daren Tan
mtext() codes set the line argument to some values. The line argument in axis() doesn't work the same way according to the help page, is there an equivalent argument in axis() that functions identically to the line argument in mtext() ? 2009/4/6 Uwe Ligges lig...@statistik.tu-dortmund.de: Daren

Re: [R] line argument in mtext for axis ?

2009-04-06 Thread Daren Tan
of your choice might do what you want. Hope that helps, Annette Daren Tan schrieb: Previously, I wasn't aware that axis() supports las arguments, and as a result, I used axis() for the ticks and mtext() to rotate the labels perpendicular to the axis. Now, I hope to cleanup my codes

[R] How to preserve NULL in vector

2009-04-06 Thread Daren Tan
I have a vector containing NULL. Referencing to that NULL gives me NA instead, which disrupt my codes. How can i preserve NULL as it is ? res - c(1,2,NULL) res[1] [1] 1 res[2] [1] 2 res[3] [1] NA __ R-help@r-project.org mailing list

[R] line argument in mtext for axis ?

2009-04-05 Thread Daren Tan
Is there a similar argument for axis that controls the position of labels via line argument in mtext ? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] Passing parameters to R script in Rgui

2009-03-27 Thread Daren Tan
How do I pass parameters to R script in Rgui ? Currently, I am using source(foo.R). Thanks __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html

[R] Warning messages from quantreg

2009-03-26 Thread Daren Tan
Hi, I keep getting warning messages from quantreg about tiny diagonals replaced with Inf when calling blkfct. Is there any cause for concern like improper codes, NAs in datasets or missing values ? Thanks Stanley __ R-help@r-project.org mailing list

[R] Combining multiple dataframes in a list

2009-03-26 Thread Daren Tan
I have a list containing multiple dataframes. Depending on whether the dataframes have 1 column or more than 1 columns, the column names are named differently. How can I force single column dataframes to have prefixed column names ? m- list(fc=data.frame(A=1:3)) do.call(cbind, m) A 1 1 2 2 3

Re: [R] Legend containing maths symbol and values of variables

2009-03-24 Thread Daren Tan
= as.expression(c(sprintf(Up (= %d), threshold),        Normal, Down, NA)) or use paste in place of sprintf. On Mon, Mar 23, 2009 at 11:53 PM, Daren Tan darenta...@gmail.com wrote: I need to have the maths symbol for = in the legend, and to substitute threshold variable with its value. Somehow

Re: [R] Legend containing maths symbol and values of variables

2009-03-24 Thread Daren Tan
)) On Tue, Mar 24, 2009 at 7:18 AM, Gabor Grothendieck ggrothendi...@gmail.com wrote: Try this: L - list(bquote(Up ( = .(threshold) ~ )), Normal, Down, NA) legend(top, leg = L) On Tue, Mar 24, 2009 at 2:52 AM, Daren Tan darenta...@gmail.com wrote: I tried sprintf and paste, which solves one

[R] Summarizing each row into a frequency table

2009-03-23 Thread Daren Tan
I have a matrix containing -1, 0, 1, however certain rows will not have all 3 numbers. I have written some codes to compute the frequency table of how many -1s, 0s, 1s per row, but it is very ugly and not efficient if there are more than 3 numbers. Please suggest. m - rbind(sample(0:1, replace=T,

[R] Legend containing maths symbol and values of variables

2009-03-23 Thread Daren Tan
I need to have the maths symbol for = in the legend, and to substitute threshold variable with its value. Somehow, various attempts weren't successful. Please help. threshold - 0.5 plot(NA, xlab=, ylab=, main=, axes=F, xlim=c(0,1), ylim=c(0,1), xaxs=i, yaxs=i) legend(x=0, y=1, fill=c(orange,

[R] gsub and regex to tidy comma-limited values

2009-03-14 Thread Daren Tan
I am cleaning up comma-limited values, so that only one comma separates each value. Using the example below, as much as I try with regex, I can't remove the last comma. I hope to have a one-liner solution, if possible. gsub(^,*|,*$|(,)*, \\1, ,,,apple,,orange,lemon,strawberry) [1]

[R] heatmap and colour key

2009-03-11 Thread Daren Tan
I would like to visualize my data via heatmap so that the value range c(-2,2) corresponds to greenred(75). However, heatmap uses the min and max from my dataset instead. How to solve this ? __ R-help@r-project.org mailing list

[R] Review my upgrade plan from 2.8.0 to 2.8.1

2009-02-28 Thread Daren Tan
Hi, On my laptop, R is installed on windows XP SP2 at D:\Program Files\R\R-2.8.0, and all add-on packages are installed at D:\Program Files\R\R-2.8.0.libs. In addition, I have created two environment enviroment to ease upgrading and installation of packages. Packages installed is a mix of those

[R] How to parse text file into a table?

2009-02-22 Thread Daren Tan
I am given a text file of records to be converted into a table format. I have searched related topics or packages, but can't find any similar cases. Please help. Sample record is given below. Take note the last element doesn't have a semi colon. ###-Start of record--

[R] Convert a list to matrix

2009-02-21 Thread Daren Tan
I would like to convert a list to matrix. This can be easily achieved via do.call. The only problem is each element of the list has different length, which causes the recycling of values. How can I have NA instead of recycled values ? m - list() m[[A]] - 1 m[[B]] - 2:3 do.call(rbind, m) [,1]

[R] How to reshape this data frame from long to wide ?

2009-02-21 Thread Daren Tan
I tried cast and melt in reshape package, but still can't convert this data frame m m [,1] [,2] [1,] A 1 [2,] A 2 [3,] B 3 to this form. m1 [,1] [,2] [1,] A B [2,] 1 3 [3,] 2 NA Please help. [[alternative HTML version deleted]]

[R] heatmap.2 and three colours for specific r anges‏

2009-01-06 Thread Daren Tan
Hi, I hope to show a heatmap with thre colours, no gradation. How to specify heatmap.2 to map green for values less than -1, gray for values between -1 and 1, and red for values greater than 1 ? Thanks [[alternative HTML version deleted]] __

Re: [R] setting the R_Libs gives warning message from Rgui.exe

2008-12-12 Thread Daren Tan
...@stat.math.ethz.ch Subject: Re: [R] setting the R_Libs gives warning message from Rgui.exe Daren Tan wrote: Hi, I keep getting the error message and a pop-up window for selecting CRAN mirror server from Rgui.exe after setting the R_Libs Warning in install.packages(necessary[!installed], dep = T

[R] What packages have impute method ?

2008-12-12 Thread Daren Tan
Besides the impute package, are there others that have alternative impute approaches ? I hope to compare their performances. Thanks __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] setting the R_Libs gives warning message from Rgui.exe

2008-12-11 Thread Daren Tan
Hi, I keep getting the error message and a pop-up window for selecting CRAN mirror server from Rgui.exe after setting the R_Libs Warning in install.packages(necessary[!installed], dep = T) : argument 'lib' is missing: using 'D:/Program Files/R/R-2.8.0.libs' --- Please select a CRAN mirror

[R] How to force aggregate to exclude NA ?

2008-12-07 Thread Daren Tan
The aggregate function does almost all that I need to summarize a datasets, except that I can't specify exclusion of NAs without a little bit of hassle. set.seed(143) m - data.frame(A=sample(LETTERS[1:5], 20, T), B=sample(LETTERS[1:10], 20, T), C=sample(c(NA, 1:4), 20, T),

Re: [R] How to force aggregate to exclude NA ?

2008-12-07 Thread Daren Tan
How to use the na.rm function outside aggregate ? I tried na.rm - function(f) { function(x, ...) f(x[!is.na(x)], ...) } na.rm(sum(c(NA,1,2))) function(x, ...) f(x[!is.na(x)], ...) na.rm(sum, c(NA,1,2)) Error in na.rm(sum, c(NA, 1, 2)) : unused argument(s) (c(NA, 1, 2)) Date:

[R] How to optimize this codes ?

2008-12-04 Thread Daren Tan
How to optimize the for-loop to be reasonably fast for sample.size=1 ? You may want to change sample.size=1000 to have an idea what I am achieving. set.seed(143) A - matrix(sample(0:1, sample.size, TRUE), ncol=10, dimnames=list(NULL, LETTERS[1:10])) B - list() for(i in 1:10) {

Re: [R] How to optimize this codes ?

2008-12-04 Thread Daren Tan
- From: William Dunlap Sent: Thursday, December 04, 2008 9:59 AM To: '[EMAIL PROTECTED]' Cc: 'R help' Subject: Re: [R] How to optimize this codes ?[R] How to optimize this codes ? Daren Tan daren76 at hotmail.com Thu Dec 4 17:02:49 CET 2008How to optimize the for-loop

[R] Yet another set of codes to optimize

2008-12-04 Thread Daren Tan
I have problems converting my dataset from long to wide format. Previous attempts using reshape package and aggregate function were unsuccessful as they took too long. Apparently, my simplified solution also lasted as long. My complete codes is given below. When sample.size = 1, the

[R] Speeding up casting a dataframe from long to wide format

2008-12-03 Thread Daren Tan
Hi, I am casting a dataframe from long to wide format. The same codes that works for a smaller dataframe would take a long time (more than two hours and still running) for a longer dataframe of 2495227 rows and ten different predictors. How to make it more efficient ? wer -

[R] Can't load Rgraphviz on windows-based R

2008-12-02 Thread Daren Tan
Hi, I have problem loading Rgraphviz. Following the instructions specified by the README in Rgraphviz_1.20.3.tar.gz didn't help either. o. set the following Windows environment variables accordingly (control panel - systems - Advanced - Environment Variables ): (a) create new user

Re: [R] Very slow: using double apply and cor.test to compute correlation p.values for 2 matrices

2008-11-26 Thread Daren Tan
Out of desperation, I made the following function which hadley beats me to it :P. Thanks everyone for the great help. cor.p.values - function(r, n) { df - n - 2 STATISTIC - c(sqrt(df) * r / sqrt(1 - r^2)) p - pt(STATISTIC, df) return(2 * pmin(p, 1 - p)) } Date: Wed, 26 Nov 2008

[R] compute pearson correlation p-values for all combinations of columns of 2 matrices

2008-11-25 Thread Daren Tan
How can I compute the pearson correlation p-values for all combinations of columns of 2 matrices ? m - matrix(rnorm(20), nrow=4, dimnames=list(LETTERS[1:4], letters[1:5])) m1 - matrix(rnorm(20), nrow=4, dimnames=list(LETTERS[1:4], letters[1:5])) cor(m,m1) a b

[R] Reshape matrix from wide to long format

2008-11-25 Thread Daren Tan
I forgot the reshape equivalent for converting from wide to long format. Can someone help as my matrix is very big. The followin is just an example. m - matrix(1:20, nrow=4, dimnames=list(LETTERS[1:4], letters[1:5])) m a b c d e A 1 5 9 13 17 B 2 6 10 14 18 C 3 7 11 15 19 D 4 8 12

[R] Very slow: using double apply and cor.test to compute correlation p.values for 2 matrices

2008-11-25 Thread Daren Tan
My two matrices are roughly the sizes of m1 and m2. I tried using two apply and cor.test to compute the correlation p.values. More than an hour, and the codes are still running. Please help to make it more efficient. m1 - matrix(rnorm(10), ncol=100) m2 - matrix(rnorm(1000), ncol=100)

[R] Prevent read.table from converting + and - to 0

2008-11-04 Thread Daren Tan
I am using read.table(data.txt, sep=\t) to read in a tab-limited text file. However, two columns of data were read wrongly. read.table converts + and - in the two columns to 0. I have tried setting other parameters but to no avail. TIA

[R] how to convert data from long to wide format ?

2008-10-30 Thread Daren Tan
Given a dataframe m m X Y V3 V4 1 1 A 0.5 1.2 2 1 B 0.2 1.4 3 2 A 0.1 0.9 How do I convert m to this with V4 as the cell values ? AB 1 1.2 1.4 2 0.9 NA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

[R] Proper way to write data frame with column and row names

2008-10-30 Thread Daren Tan
I need to write a data frame along with its column and row names to a text file. However, the first row in the text file is always short of one element. I have tried setting different parameters to write.table but that didn't help. m A B C 1 2 D 3 4 Using write.table(m, table.xls, sep=\t,

[R] Beautify R scripts in microsoft word

2008-09-13 Thread Daren Tan
I am generating a report containing several R scripts in the appendix. Is there any way to beautify the R source codes in microsoft word, similar to what we see in tinn-R ? Thanks _ [[alternative HTML version deleted]]

[R] Test of Homogeneity of Variances

2008-08-22 Thread Daren Tan
I am testing the homogeneity of variances via bartlett.test and fligner.test. Using the following example, how should I interpret the p-value in order to accept or reject the null hypothesis ? set.seed(5) x - rnorm(20) bartlett.test(x, rep(1:5, each=4)) Bartlett test of homogeneity

Re: [R] Test of Homogeneity of Variances

2008-08-22 Thread Daren Tan
? Once you state what they are, interpretation should be straightforward. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Daren Tan Sent: Friday, August 22, 2008 11:18 AM To: [EMAIL PROTECTED] Subject: [R] Test of Homogeneity of Variances I am

[R] Understanding output of summary(glm(...))

2008-08-20 Thread Daren Tan
Simple example of 5 groups of 4 replicates. set.seed(5) tmp - rnorm(20) gp - as.factor(rep(1:5,each=4)) summary(glm(tmp ~ -1 + gp, data=data.frame(tmp, gp)))$coefficients Estimate Std. Error t value Pr(|t|)gp1 -0.1604613084 0.4899868 -0.3274809061 0.7478301gp2

[R] How to solve this problem ?

2008-08-20 Thread Daren Tan
I have disabled html text editing mode, thanks to Prof. Ripley for the kind reminder. Given three geological devices that takes 5 readings at 4 environmental conditions (A to D). What will be the proper approach to select the most reliable device ? m1 -

Re: [R] How to solve this problem ?

2008-08-20 Thread Daren Tan
Small progress, I am relying on levene test to check for equality of variances. Is my understanding correct, the larger the p-value, the more likely the variances are the same ? trt [1] 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 Levels: 1 2 3 4 levene.test(rep(rnorm(5), 4), trt, option=median)

[R] Identifying common prefixes from a vector of words, and delete those prefixes

2008-07-31 Thread Daren Tan
For example, c(dog.is.an.animal, cat.is.an.animal, rat.is.an.animal). How can I identify the common prefix is .is.an.animal and delete it to give c(dog, cat, rat) ? Thanks _ [[alternative HTML version deleted]]

[R] Can't get the correct order from melt.data.frame of reshape library.

2008-07-26 Thread Daren Tan
Simple illustration, df3 - data.frame(id=c(3,2,1,4), age=c(40,50,60,50), dose1=c(1,2,1,2), dose2=c(2,1,2,1), dose4=c(3,3,3,3)) df3 id age dose1 dose2 dose41 3 40 1 2 32 2 50 2 1 33 1 60 1 2 34 4 50 2 1 3 melt.data.frame(df3,

[R] convert a vector of words into a matrix

2008-07-24 Thread Daren Tan
How to convert the strings into matrix ? (strings - strsplit(c(1 2 3, 1 2, 1 3 4 5), ))[[1]][1] 1 2 3 [[2]][1] 1 2 [[3]][1] 1 3 4 5 _ Easily edit your photos like a pro with Photo Gallery. [[alternative HTML version

Re: [R] convert a vector of words into a matrix

2008-07-24 Thread Daren Tan
: Re: [R] convert a vector of words into a matrix And what should the matrix look like? Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Daren Tan wrote: How to convert the strings into matrix

[R] How to preserve the numeric format and digits ?

2008-07-24 Thread Daren Tan
Instead of m - c(4, 500) paste(A, m, B, sep=) [1] A4e+08B A5e+10B I want A4 and A500 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] counting number of G in TCGGGGGACAATCGGTAACCCGTCT

2008-07-15 Thread Daren Tan
Any better solution than this ? sum(strsplit(TCGACAATCGGTAACCCGTCT, )[[1]] == G) _ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

[R] Computing row means for sets of 2 columns

2008-07-13 Thread Daren Tan
Is there a better or more efficent approach than this without the use of t() ? (m - matrix(1:40, ncol=4)) [,1] [,2] [,3] [,4] [1,]1 11 21 31 [2,]2 12 22 32 [3,]3 13 23 33 [4,]4 14 24 34 [5,]5 15 25 35 [6,]6 16 26 36 [7,]

[R] How to check how much memory has been used or reserved ?

2008-07-10 Thread Daren Tan
Creating variables for small dataset is very mundane, but lately I am dealing with 10^7 by 10^3 datasets which eats up alot of memory. How can I monitor how much has been used or reserved ? _ [[alternative HTML version

[R] How to output 0.405852702657738 as 0.405853 ?

2008-07-10 Thread Daren Tan
I am confused by options(digits) and options(scipen), which should be used to output 0.405852702657738 as 0.405853 in write.table ? _ [[alternative HTML version deleted]] __

[R] Can R do this ?

2008-07-08 Thread Daren Tan
I have a folder full of pngs and jpgs, and would like to consolidate them into a pdf with appropriate title and labels. Can this be done via R ? _ Easily publish your photos to your Spaces with Photo Gallery. [[alternative

[R] Installing R package but got Fortran 90 error

2008-07-08 Thread Daren Tan
I am installing a package but got the following error. How can I install this package ? R_HOME is /home/daren/MyHome/lib64/RAttempting to determine R_ARCH...R_ARCH isAttempting to detect how R was configured for Fortran 90Unsupported Fortran 90 compiler or Fortran 90compilers

[R] How can I optimize this piece of code ?

2008-07-07 Thread Daren Tan
Currently it needs 50+ mins to run on a 80 rows. I need to run it hundreds of times :P t(apply(unique_ids, 1, function(x) { sd(subset(m[, 5:20], m[,ID] == x)) } )) _ [[alternative HTML version deleted]]

[R] passing arguments to a R script

2008-07-04 Thread Daren Tan
I would like to pass several arguments to a R script. How can I do that ? R test.R arg1 arg2 arg3 _ Easily edit your photos like a pro with Photo Gallery. [[alternative HTML version deleted]]

[R] How to emulate perl style of reading files ?

2008-07-03 Thread Daren Tan
I tried the following, obviously it didn't work. Hope you get my point, how to do it in R ? My objective is to read a large fasta file (but not storing the entire data into memory) , and compute some sequence composition statistics. while(a - readLines(test1) != EOF) print(a)

[R] how to capture matching words in a string ?

2008-07-02 Thread Daren Tan
I need to capture matching words in a string, any ideas ? I tried using gregexpr, but it was no help. In this example, I need to capture ID23423424 and ID324234325 s - sID23423424 apple pID324234325 orange gregexpr(ID[0-9]+, s)[[1]][1] 2 20attr(,match.length)[1] 10 11

[R] Processing 10^8 rows and 1^3 columns

2008-07-02 Thread Daren Tan
With smaller tab-limited files, I could load them using read.table and the likes. Now I have a gigantic 10^8 rows and 1^3 columns tab-limited file for processsing, please throw some ideas how to handle it. Thanks _ Publish your

[R] insert new columns to a matrix

2008-06-24 Thread Daren Tan
Instead of prepend or append new columns to a matrix, how to insert them to a matrix ? For example, I would like to insert 3 new columns after the 5th column of matrix m. _ [[elided Hotmail spam]] [[alternative HTML

[R] grouping values

2008-06-23 Thread Daren Tan
I tried aggregate, apply etc, but can't get the right result. For example, m - cbind(c(LETTERS[1:5]), c(aa, bb, cc, aa, cc)) [,1] [,2][1,] A aa[2,] B bb[3,] C cc[4,] D aa[5,] E cc how to obtain m.new where aa, bb, and cc are groups, and more than one values A to E belonging to

Re: [R] grouping values

2008-06-23 Thread Daren Tan
Any solution to my problem ? To: [EMAIL PROTECTED] From: [EMAIL PROTECTED] Date: Mon, 23 Jun 2008 13:25:02 + Subject: Re: [R] grouping values Daren Tan daren76 at hotmail.com writes: I tried aggregate, apply etc, but can't get the right result. For example, m - cbind(c(LETTERS[1

[R] replacing segments of vector by their averages

2008-06-19 Thread Daren Tan
Given a vector of numeric of length n, I need to find segments that are = 0.2, compute the average of individual segments, and replace the original values in each segment by their corresponding averages. For example, there are three segments that are = 0.2, the average of 1st segment is

[R] computing the average and standard deviation for many sets of triplicates, using R-approach

2008-06-18 Thread Daren Tan
Below example has 4 sets of triplicates, without using for loop and iteratively cbind the columns, what is the R-approach of generating a matrix of 8 columns that are the averages and standard deviations ? The average and standard deviation columns should be side by side i.e. A.mean A.sd

[R] operations on all pairs of columns from two matrices

2008-06-18 Thread Daren Tan
m1 - matrix(rnorm(40), ncol=4) m2 - matrix(rnorm(40), ncol=4) I would like to subtract first column of m1 from all columns of m2, subtract 2nd of m1 from all columns of m2, and so on. Obviously, I am not using the appropriate function outer(m1, m1, -), since the first column isn't all 0s.

[R] Any simple way to subset a vector of strings that do contain a particular substring ?

2008-06-18 Thread Daren Tan
For example, strings - c(, ,ccba). How to get , that do not contain ba ? _ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

[R] longest common substring

2008-06-17 Thread Daren Tan
i need to compute the longest common substring of two strings, can R do that ? _ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

[R] unique-fy colume names

2008-06-16 Thread Daren Tan
I have a column containing duplicate entries and need to append numeric suffixes to make them unique. How ? e.g., paste(id, c(1:10,1,5,10,10), sep=.) [1] id.1 id.2 id.3 id.4 id.5 id.6 id.7 id.8 id.9[10] id.10 id.1 id.5 id.10 id.10 I hope to get [1] id.1 id.2 id.3 id.4 id.5

[R] Very puzzled why swapping the columns doesn't swap the column names

2008-06-16 Thread Daren Tan
How can I swap the column names at the same time ? m - cbind(x=1:3, y=2:4, z=3:5) m x y z[1,] 1 2 3[2,] 2 3 4[3,] 3 4 5 m[,c(1,2)] - m[,c(2,1)] m x y z[1,] 2 1 3[2,] 3 2 4[3,] 4 3 5 _ [[alternative HTML version

[R] ADaCGH package crashes at mpiInit()

2008-06-12 Thread Daren Tan
I have successfully installed ADaCGH package, and trying the example in SegmentPlotWrite did produce alot of pngs and html. I tried again the same example this morning (after a long night of installation), ADaCGH crashes at mpiInit() showing the error: Loading required package: Rmpi

[R] Fast method to compute average values of duplicated IDs

2008-06-10 Thread Daren Tan
Hi, How do I collapse (average in the simplest case) the values of those duplicated ids (i.e., 2, 5, 6, 9) to give a table of unique ids ? t - cbind(id=c(1:10, 2,5,6,9), value=rnorm(14)) _ [[alternative HTML