An excerpt from dataset ChickWeight:
    weight Time Chick Diet
1       42    0     1    1
2       51    2     1    1
3       59    4     1    1

I am interested in the residuals of the dataset.  Specifically in
saving them to another format. I have been creating text files with
sink.

CW.lm <- lm(weight ~ Diet, ChickWeight)
resid.CW.lm <- resid(CW.lm)

But when I call:
resid.CW.lm

The data appears like this (excerpt) :

           1            2            3            4            5            6
 -60.6454545  -51.6454545  -43.6454545  -38.6454545  -26.6454545   -9.6454545

How can I get the data to be formatted like below in an output / sink
friendly way?

1 -60.6454545
2 -51.6454545
3 -43.6454545
4 -38.6454545
5 -26.6454545
6 -9.6454545

Thank you kindly,
Cheers,
Mike

______________________________________________
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