[R] and now a "cut" question

Bill.Venables at csiro.au Bill.Venables at csiro.au
Wed Jun 22 00:01:23 CEST 2011


> con <- 
+ textConnection("13053 13068 13068 13053 14853 14853 14850 14850 13053 13053 13068 13068
+ ")
> x <- scan(con)
Read 12 items
> 
> cut(x, 4)
 [1] (1.31e+04,1.35e+04] (1.31e+04,1.35e+04] (1.31e+04,1.35e+04]
 [4] (1.31e+04,1.35e+04] (1.44e+04,1.49e+04] (1.44e+04,1.49e+04]
 [7] (1.44e+04,1.49e+04] (1.44e+04,1.49e+04] (1.31e+04,1.35e+04]
[10] (1.31e+04,1.35e+04] (1.31e+04,1.35e+04] (1.31e+04,1.35e+04]
4 Levels: (1.31e+04,1.35e+04] (1.35e+04,1.4e+04] ... (1.44e+04,1.49e+04]
> 
> cut(x, 4, dig.lab = 5)
 [1] (13051,13502] (13051,13502] (13051,13502] (13051,13502] (14404,14855]
 [6] (14404,14855] (14404,14855] (14404,14855] (13051,13502] (13051,13502]
[11] (13051,13502] (13051,13502]
Levels: (13051,13502] (13502,13953] (13953,14404] (14404,14855]
>  

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Erin Hodgess
Sent: Tuesday, 21 June 2011 10:46 AM
To: R help
Subject: [R] and now a "cut" question

Hello again R People:

I have the following:

> xm1[,1]
 [1] 13053 13068 13068 13053 14853 14853 14850 14850 13053 13053 13068 13068
> cut(xm1[,1],4)
 [1] (1.31e+04,1.35e+04] (1.31e+04,1.35e+04] (1.31e+04,1.35e+04]
 [4] (1.31e+04,1.35e+04] (1.44e+04,1.49e+04] (1.44e+04,1.49e+04]
 [7] (1.44e+04,1.49e+04] (1.44e+04,1.49e+04] (1.31e+04,1.35e+04]
[10] (1.31e+04,1.35e+04] (1.31e+04,1.35e+04] (1.31e+04,1.35e+04]
4 Levels: (1.31e+04,1.35e+04] (1.35e+04,1.4e+04] ... (1.44e+04,1.49e+04]
>

Is there any way to have the levels print as 13100, 13500, etc., please?

Thanks,
Erin


-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodgess at gmail.com

______________________________________________
R-help at 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
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list