Re: [R] sort by column and row names

2011-02-17 Thread Jim Moon
Yes, that is it. Thank you very much, Phil. -Original Message- From: Phil Spector [mailto:spec...@stat.berkeley.edu] Sent: Thursday, February 17, 2011 3:36 PM To: Jim Moon Cc: r-help@r-project.org Subject: Re: [R] sort by column and row names Jim - I believe dat[order(rownames

[R] sort by column and row names

2011-02-17 Thread Jim Moon
Hello, All, How can one sort on column and row names. For example: How can this X1 X3 X2 X1 1 0 0 X3 0 1 0 X2 0 0 1 become this? X1 X2 X3 X1 1 0 0 X2 0 1 0 X3 0 0 1 Thank you for your time! Jim [[alternative H

[R] GWAF package: lme.batch.imputed(): object 'kmat' not found

2011-02-04 Thread Jim Moon
Hello, All, GWAF 1.2 R.Version() is below. system(lme.batch.imputed( phenfile = 'phenfile.csv', genfile = 'CARe_imputed_release.0.fhsR.gz', pedfile='pedfile.csv', phen='phen1', covar=c('covar1','covar2'), kinmat='imputed_fhs.kinship.RData', outfile='imputed.FHS.IBC.GWAF.LME.output.0.txt' )) Give

Re: [R] write.table -- maintain decimal places

2011-01-26 Thread Jim Moon
Great. Thank you, Peter! -Original Message- From: Peter Ehlers [mailto:ehl...@ucalgary.ca] Sent: Tuesday, January 25, 2011 7:26 PM To: Jim Moon Cc: r-help@r-project.org Subject: Re: [R] write.table -- maintain decimal places On 2011-01-25 17:22, Jim Moon wrote: > Thank you for

Re: [R] write.table -- maintain decimal places

2011-01-26 Thread Jim Moon
I am using: "R version 2.11.1 (2010-05-31)" It is good to know that it works in 2.12.1 Jim -Original Message- From: Peter Ehlers [mailto:ehl...@ucalgary.ca] Sent: Tuesday, January 25, 2011 5:57 PM To: Jim Moon Cc: r-help@r-project.org Subject: Re: [R] write.table -- mainta

Re: [R] write.table -- maintain decimal places

2011-01-25 Thread Jim Moon
0.45200 df.txt: EFFECT2PVALUE 0.023 8.808e-01 -0.26 8.641e-02 -0.114 4.520e-01 -Original Message- From: Peter Ehlers [mailto:ehl...@ucalgary.ca] Sent: Tuesday, January 25, 2011 5:09 PM To: Jim Moon Cc: r-help@r-project.org Subject: Re: [R] write.table -- maintain decimal pl

[R] write.table -- maintain decimal places

2011-01-25 Thread Jim Moon
Hello, All, How can I maintain the decimal places when using write.table()? Jim e.g. df: EFFECT2 PVALUE 1 0.0230.88080 2 -0.260 0.08641 3 -0.114 0.45200 write.table(df,file='df.txt',quote=F,sep='\t',row.names=F) df.txt: EFFECT2PVALUE 0.023 0.8808 -0.26 0.08641 -0.114

Re: [R] read in data, maintain decimal places

2011-01-14 Thread Jim Moon
David, Perfect. Thank you! Jim -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Friday, January 14, 2011 2:26 PM To: Jim Moon Cc: r-help@r-project.org Subject: Re: [R] read in data, maintain decimal places On Jan 14, 2011, at 5:22 PM, Jim Moon wrote

[R] read in data, maintain decimal places

2011-01-14 Thread Jim Moon
Good day, All, Is there any way to maintain the number of decimal places in the type of situation below? I would like to maintain the number of decimal places in 0.667, despite the fact that its column-mates have a fourth decimal place. Thank you for your time. Jim dat.txt contents: MARK

[R] with(data.frame,ifelse(___,___,___))

2010-12-22 Thread Jim Moon
Hello, All, Mac OS 10.6.5 R64 2.11.1 This works as expected: f1 = c(0.084, 0.099, 0) data= data.frame(f1) data$f1=with(data,ifelse(f1==0, 0.0001, f1)) data f1 1 0.0840 2 0.0990 3 0.0001 Substituting 'f1==0' with 'T' produces the expected result: f1 = c(0.084, 0.099, 0) data= data.frame(f

[R] Write.table eol argument

2010-12-21 Thread Jim Moon
Hello All, R 2.11.1 Windows XP, 32-bit Help says that default is eol='\n'. To me, that represents Linefeed (LF) >From Help: eol the character(s) to print at the end of each line (row). For example, eol="\r\n" will produce Windows' line endings on a Unix-alike OS, and eol="\r" will produce

Re: [R] sd() for numeric row entries

2010-12-08 Thread Jim Moon
This is very helpful, Phil. Being new to R and trying to get a handle on *apply, by, aggregate... this is great. Thank you. Jim -Original Message- From: Phil Spector [mailto:spec...@stat.berkeley.edu] Sent: Wednesday, December 08, 2010 2:36 PM To: Jim Moon Cc: r-help@r

[R] sd() for numeric row entries

2010-12-08 Thread Jim Moon
How might one calculate standard deviation, row-wise, for the numeric values in a data frame such as this one V1 V2 V3 V4 V5 1 rs11089130 0.4565 0.4574 0.4569 0.4572 2 rs738829 0.6548 0.6519 0.6448 0.6549 3 rs915674 0.7503 0.7500 0.7517 0.7502 and place the standard d

Re: [R] FW: how to use by() ?

2010-11-29 Thread Jim Moon
Well-phrased, David. :-) Jim -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Monday, November 29, 2010 10:53 AM To: Jim Moon Cc: r-help@r-project.org Subject: Re: [R] FW: how to use by() ? On Nov 29, 2010, at 1:36 PM, Jim Moon wrote: > Thank you

Re: [R] FW: how to use by() ?

2010-11-29 Thread Jim Moon
Thank you, Bill. That fixed it. Jim -Original Message- From: William Dunlap [mailto:wdun...@tibco.com] Sent: Monday, November 29, 2010 10:46 AM To: Jim Moon; r-help@r-project.org Subject: RE: [R] FW: how to use by() ? ifelse(cond,ifTrue,ifFalse) doesn't do what you want when i

Re: [R] how to use by() ?

2010-11-29 Thread Jim Moon
Jim Moon ohsu.edu> writes: > How might one accomplish this using the by() function? > m1 is a data frame. > > # populate column "m1$major_allele" > for ( i in 1:length(m1$major_allele)) { > if ( m1$Freq1[i] == m1$MAF[i]){ > m1$major_allele[i] = m

[R] FW: how to use by() ?

2010-11-29 Thread Jim Moon
C 4 C T 0.9908 0.0092C Jim -Original Message- From: William Dunlap [mailto:wdun...@tibco.com] Sent: Monday, November 29, 2010 10:02 AM To: Jim Moon Subject: RE: [R] how to use by() ? m1$major_allele <- with(m1, ifelse(Freq1==MAF, Al1, Al2)) Bill Dunlap Spotfire, TIBCO Softwar

[R] how to use by() ?

2010-11-29 Thread Jim Moon
Hello, All! How might one accomplish this using the by() function? m1 is a data frame. # populate column "m1$major_allele" for ( i in 1:length(m1$major_allele)) { if ( m1$Freq1[i] == m1$MAF[i]){ m1$major_allele[i] = m1$Al1[i] } else{ m1$major_allele[i] = m1$Al2[i] } } Jim