Dear all,
Is there a simple way to strip the leading "0"'s from R output? For example,
I want
Data <- data.frame(x=rnorm(10), y=x*rnorm(10), z = x+y+rnorm(10))
cor(Data)
to give me
x y z
x 1.0000000 -.1038904 -.3737842
y -.1038904 1.0000000 .4414706
z -.3737842 .4414706 1.0000000
Several of you were kind enough to alert me to the existence of gsub a few
weeks ago, so I can do
gsub("0\\.","\\.",cor(Data))
but I'm hoping someone has a better way (e.g, one that returns an object of
the same class as the original, preserving dimnames, etc.)
Thanks,
Ista
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.