[R] Trying to "pretty up" output from R job
Paul E Johnson
pauljohn at ukans.edu
Sun Aug 6 22:47:19 CEST 2000
Running R 1.1 on RedHat Linux 6.2.
I need to write a shell script that goes through a bunch of directories
of simulation output, creating summary files that have the mean and
standard deviation of the variables found in the data files in each
directory. I've got the R code doing almost the right thing. It reads
in data, then gets the mean and standard deviation for the numeric
variables, puts those results together, and then grabs the directory
name from the system and jams that in to the results as well. Here is
what I have:
data<-read.table("lastline.txt",header=T,as.is = TRUE)
The output file looks like this:
dir /home/pauljohn/swarm/src /home/pauljohn/swarm/src
T 732.1 148.618520536522
Run 49.5 29.011491975882
Seed 499366074.13 296739559.579976
IntAct 43.85 5.592879672432
Change 0 0
Now the questions:
1. I want 3 columns of output, but here the first line only has two
items. I can't see any way to make it put out a lable for the first
column, like "Variable" or some such.
2. Can you tell me how to truncate the numerical printout so it only
shows two numbers after the decimal point?
3. Is my way of keeping track of the directory completely ridiculous?
How else would you do it?
4. My next chore is to find how to make this thing run through a series
of directories, summarizing each. Would you recommend I do this with a
shell script or something within R itself?
Paul E. Johnson email: pauljohn at ukans.edu
Dept. of Political Science http://lark.cc.ukans.edu/~pauljohn
University of Kansas Office: (785) 864-9086
Lawrence, Kansas 66045 FAX: (785) 864-5700
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help