Try auto-printing, e.g.

three
[[1]]
 a b
 1 x
 2 y
 3 z

[[2]]
 a b
 4 q
 5 r
 6 s

or change print.data.frame *in the base namespace* by fixInNamespace.

When you said you 'reloaded that function' I suspect that in fact you source()-d it into a different place, your workspace.


On Sun, 10 Aug 2008, Daniel Ezra Johnson wrote:

This should be an easy one, but I could not find the answer in the
obvious places.

one <- data.frame(a=c(1,2,3),b=c("x","y","z"))
two <- data.frame(a=c(4,5,6),b=c("q","r","s"))

print(one)
a b
1 1 x
2 2 y
3 3 z

print(one,row.names=F)
a b
1 x
2 y
3 z

So far, so good, but how do I do this if the data frames are bound into a list?

three <- list(one,two)
print(three,row.names=F)  #same as print(three,row.names=T)

[[1]]
a b
1 1 x
2 2 y
3 3 z

[[2]]
a b
1 4 q
2 5 r
3 6 s

Is there any way to stop the row (or column) names from printing in a
case like this?
I just thought of one way - change the default in print.data.frame()
and reload that function.

Surprisingly, that does not work. I have successfully changed the
behavior of:

print(one)
one

These now print without row names, but

print(three)

continues to print the row names, even though

class(three[[1]])

is "data.frame", so I'm not clear why it doesn't take the print
defaults from print.data.frame!

Any advice would be appreciated. I can live with the row names, but
there are cases where I want to suppress them within a list.

Thanks,
Daniel

______________________________________________
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.


--
Brian D. Ripley,                  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
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.

Reply via email to