[R] Wrap column headers caption

2010-07-13 Thread Felipe Carrillo
Hi:
Using this dataframe with quite long column headers, how can I wrap the 
text so that the columns are narrower. I was trying to use strwrap without 
success. Thanks

reportDF - structure(list(IDDate = c(3/12/2010, 3/13/2010, 3/14/2010,
3/15/2010), FirstRunoftheYear = c(33 (119 ? 119), n (0 ? 0), 893 (110 ? 
146),
140 (111 ? 150)), SecondRunoftheYear = c(33 (71 ? 71), n (0 ? 0),
337 (67 ? 74), 140 (68 ? 84)), ThirdRunoftheYear = c(890 (32 ? 47),
n (0 ? 0), 10,602 (32 ? 52), 2,635 (34 ? 66)), FourthRunoftheYear = c(0 
( 
? ),
n (0 ? 0), 0 ( ? ), 0 ( ? )), LastRunoftheYear = c(0 ( ? ), n (0 ? 0),
0 ( ? ), 0 ( ? ))), .Names = c(IDDate, First Run of the Year, Second 
Run of the Year,
Third Run of the Year, Fourth Run of the Year, Last Run of the Year), 
row.names = c(NA, 4L), class = data.frame)
 


Felipe D. Carrillo
Supervisory Fishery Biologist
Department of the Interior
US Fish  Wildlife Service
California, USA




__
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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Wrap column headers caption

2010-07-13 Thread Henrique Dallazuanna
You can't try this:

sapply(names(reportDF), toString, width = 10)

abbreviate(names(reportDF))

On Tue, Jul 13, 2010 at 2:43 PM, Felipe Carrillo
mazatlanmex...@yahoo.comwrote:

 Hi:
 Using this dataframe with quite long column headers, how can I wrap the
 text so that the columns are narrower. I was trying to use strwrap without
 success. Thanks

 reportDF - structure(list(IDDate = c(3/12/2010, 3/13/2010,
 3/14/2010,
 3/15/2010), FirstRunoftheYear = c(33 (119 ? 119), n (0 ? 0), 893
 (110 ?
 146),
 140 (111 ? 150)), SecondRunoftheYear = c(33 (71 ? 71), n (0 ? 0),
 337 (67 ? 74), 140 (68 ? 84)), ThirdRunoftheYear = c(890 (32 ? 47),
 n (0 ? 0), 10,602 (32 ? 52), 2,635 (34 ? 66)), FourthRunoftheYear =
 c(0 (
 ? ),
 n (0 ? 0), 0 ( ? ), 0 ( ? )), LastRunoftheYear = c(0 ( ? ), n (0 ?
 0),
 0 ( ? ), 0 ( ? ))), .Names = c(IDDate, First Run of the Year,
 Second
 Run of the Year,
 Third Run of the Year, Fourth Run of the Year, Last Run of the Year),
 row.names = c(NA, 4L), class = data.frame)



 Felipe D. Carrillo
 Supervisory Fishery Biologist
 Department of the Interior
 US Fish  Wildlife Service
 California, USA




 __
 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
 and provide commented, minimal, self-contained, reproducible code.




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

[[alternative HTML version deleted]]

__
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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Wrap column headers caption

2010-07-13 Thread Erik Iverson


Using this dataframe with quite long column headers, how can I wrap the 
text so that the columns are narrower. I was trying to use strwrap without 
success. Thanks


reportDF - structure(list(IDDate = c(3/12/2010, 3/13/2010, 3/14/2010,
3/15/2010), FirstRunoftheYear = c(33 (119 ? 119), n (0 ? 0), 893 (110 ? 
146),

140 (111 ? 150)), SecondRunoftheYear = c(33 (71 ? 71), n (0 ? 0),
337 (67 ? 74), 140 (68 ? 84)), ThirdRunoftheYear = c(890 (32 ? 47),
n (0 ? 0), 10,602 (32 ? 52), 2,635 (34 ? 66)), FourthRunoftheYear = c(0 ( 
? ),

n (0 ? 0), 0 ( ? ), 0 ( ? )), LastRunoftheYear = c(0 ( ? ), n (0 ? 0),
0 ( ? ), 0 ( ? ))), .Names = c(IDDate, First Run of the Year, Second 
Run of the Year,
Third Run of the Year, Fourth Run of the Year, Last Run of the Year), 
row.names = c(NA, 4L), class = data.frame)


I could be wrong here, but I don't think there's a way to do that as 
print.data.frame is currently defined.  You might find the print.gap 
argument of some use, it ultimately gets passed down to print.default 
and will affect the output.


I can't think of a way to do this, hopefully someone else will have an 
idea.


__
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
and provide commented, minimal, self-contained, reproducible code.