Subodh Acharya
2009-Oct-27 19:51 UTC
[R] option to control the spac between columns in data frame
Hello, I have a question regarding a way to control the appreance of output exported by R when I use capture.output( x, file = "Directory/file.txt") , I get a text file which when I paste to a word file looks like the first table below. The following table has its clumns spaced closely so when I paste it to a word file it looks continuous. Is there any option in R to make the outputs like the second table? Any help will be highly appreciated. Thank you very much in advance. Model 1 4/70-3/80 Year 2 Source Area Runoff Nitrogen Phosphorus V1 LDR_imperv 203 52.6 1496.0 190.0 V2 LDR_perv 1147 5.7 489.6 163.6 V3 MDR_imperv 281 52.6 4141.7 654.7 V4 MDR_Perv 654 5.7 511.8 227.4 V5 IND_imperv 97 52.6 1604.4 226.0 V6 IND_perv 42 5.7 17.9 7.1 V7 COM_imperv 158 52.6 2613.4 368.1 V8 COM_perv 157 5.7 67.0 26.6 Total 10942 1302.2 Source Area Runoff Nitrogen Phosphorus V1 LDR_imperv 203 52.6 1496.0 190.0 V2 LDR_perv 1147 5.7 489.6 163.6 V3 MDR_imperv 281 52.6 4141.7 654.7 V4 MDR_Perv 654 5.7 511.8 227.4 V5 IND_imperv 97 52.6 1604.4 226.0 -- Acharya, Subodh [[alternative HTML version deleted]]
David Winsemius
2009-Oct-28 00:05 UTC
[R] option to control the spac between columns in data frame
On Oct 27, 2009, at 3:51 PM, Subodh Acharya wrote:> Hello, > I have a question regarding a way to control the appreance of output > exported by R > when I use capture.output( x, file = "Directory/file.txt") , I get a > text > file which when I paste to a word file looks like the first table > below. > > The following table has its clumns spaced closely so when I paste it > to a > word file it looks continuous. Is there any option in R to make the > outputs > like the second table?> ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) > trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) > group <- gl(2,10,20, labels=c("Ctl","Trt")) > weight <- c(ctl, trt) > print(anova(lm.D9 <- lm(weight ~ group)) ) Analysis of Variance Table Response: weight Df Sum Sq Mean Sq F value Pr(>F) group 1 0.6882 0.6882 1.4191 0.249 Residuals 18 8.7292 0.4850 > print(anova(lm.D9 <- lm(weight ~ group)), print.gap=6) Analysis of Variance Table Response: weight Df Sum Sq Mean Sq F value Pr(>F) group 1 0.6882 0.6882 1.4191 0.249 Residuals 18 8.7292 0.4850> > Any help will be highly appreciated. > > > Thank you very much in advance. > > > Model 1 > 4/70-3/80 Year 2 > > Source Area Runoff Nitrogen Phosphorus > V1 LDR_imperv 203 52.6 1496.0 190.0 > V2 LDR_perv 1147 5.7 489.6 163.6 > V3 MDR_imperv 281 52.6 4141.7 654.7 > V4 MDR_Perv 654 5.7 511.8 227.4 > V5 IND_imperv 97 52.6 1604.4 226.0 > V6 IND_perv 42 5.7 17.9 7.1 > V7 COM_imperv 158 52.6 2613.4 368.1 > V8 COM_perv 157 5.7 67.0 26.6 > Total 10942 1302.2 > > Source Area Runoff Nitrogen Phosphorus > V1 LDR_imperv 203 52.6 1496.0 > 190.0 > V2 LDR_perv 1147 5.7 489.6 > 163.6 > V3 MDR_imperv 281 52.6 4141.7 > 654.7 > V4 MDR_Perv 654 5.7 511.8 > 227.4 > V5 IND_imperv 97 52.6 1604.4 > 226.0 > > -- > Acharya, Subodh > > [[alternative HTML version deleted]] > > ______________________________________________ > 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.David Winsemius, MD Heritage Laboratories West Hartford, CT