[R] Suppressing script commands in R console when executing long program

Philipp Pagel p.pagel at wzw.tum.de
Fri Sep 18 12:59:16 CEST 2009


On Fri, Sep 18, 2009 at 03:46:27PM +1000, Steven Kang wrote:
> *Q1. Are there any way of suppressing the commands in the R console?*

I think this has been answered already.

> *Q2. Is R capable of reading numbers that are represented with 1,000
> separator commas?*

I am not aware of an option to read.table and freinds that does this
but you can recover easily:

> foo <- read.delim('foo.tbl')
> foo
  A          B
1 1     12,300
2 2 256,001.01
3 3      900.1
4 4         80
> str(foo)
'data.frame':   4 obs. of  2 variables:
 $ A: int  1 2 3 4
 $ B: Factor w/ 4 levels "12,300","256,001.01",..: 1 2 4 3
> foo$B <- as.numeric(sub(',', '', as.character(foo$B)))
> foo
  A        B
1 1  12300.0
2 2 256001.0
3 3    900.1
4 4     80.0
> str(foo)
'data.frame':   4 obs. of  2 variables:
 $ A: int  1 2 3 4
 $ B: num  12300 256001 900 80


cu
	Philipp

-- 
Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
85350 Freising, Germany
http://webclu.bio.wzw.tum.de/~pagel/




More information about the R-help mailing list