Tony Vargas
2003-Feb-12 19:24 UTC
[R] Three questions - loading(sourcing a file??), summaries to bitmaps, and error messages
R helpers,
I have three questions about R and was wondering if I could get some help.
First, I am trying to send the output of a a summary command -
summary("info") to a bitmap file instead of the default device.
Anybody
know how to send a summary to a bitmap device?
Second - this question is more difficult. What I am trying to do is have
Perl (because I already have the data structures loaded into
hashes) generate a gigantic R file that I can then have R source, and then
parse. The output of the file(s) that I generate is below:
my.badger.Sep.2002.cpu.utilization <-
read.table(file="/auto/solperf/tgu/ActiveParsedFiles/badger/Sep.2002/cpu.utilization",
sep="=", header=TRUE) names(my.badger.Sep.2002.cpu.utilization)
attach(my.badger.Sep.2002.cpu.utilization) Tony Vargas Cisco Systems
Engineering Computing Services (408) 525-4113 tvargas at cisco.com
my.balvenie.Sep.2002.cpu.utilization <-
read.table(file="/auto/solperf/tgu/ActiveParsedFiles/balvenie/Sep.2002/cpu.utilization",
sep="=", header=TRUE) names(my.balvenie.Sep.2002.cpu.utilization)
attach(my.balvenie.Sep.2002.cpu.utilization)
my.bobcat.Sep.2002.cpu.utilization <-
read.table(file="/auto/solperf/tgu/ActiveParsedFiles/bobcat/Sep.2002/cpu.utilization",
sep="=", header=TRUE) names(my.bobcat.Sep.2002.cpu.utilization)
attach(my.bobcat.Sep.2002.cpu.utilization)
my.bowmore.Sep.2002.cpu.utilization <-
read.table(file="/auto/solperf/tgu/ActiveParsedFiles/bowmore/Sep.2002/cpu.utilization",
sep="=", header=TRUE) names(my.bowmore.Sep.2002.cpu.utilization)
attach(my.bowmore.Sep.2002.cpu.utilization)
etc. . . .
My "plotting" file looks like this:
bitmap(file
"/auto/solperf/tgu/Images/badger.Sep.2002.usr.cpu.summary.thumbnail",
type
= "png256", height = 6, width = 6, res = 72")
summary(my.badger.Sep.2002.cpu.utilization) bitmap(file
"/auto/solperf/tgu/Images/badger.Sep.2002.usr.cpu.lines.thumbnail",
type "png256", height = 6, width = 6, res = 72")
lines(usr.cpu ~ Time, xlab = "Time", ylab = "%Usr CPU
Utilization", main
= "badger's %Usr CPU Utilization Sep.2002")
legend(0,0, usr.cpu) bitmap(file
"/auto/solperf/tgu/Images/badger.Sep.2002.usr.cpu.scatter.thumbnail",
type
= "png256", height = 6, width = 6, res = 72")
plot(usr.cpu, main = "Scatter plot of badger's %Usr CPU Utilization
Sep.2002")
legend(0,0, usr.cpu) bitmap(file
"/auto/solperf/tgu/Images/badger.Sep.2002.usr.cpu.summary.large", type
"png256",
I tried having R do a "load" on my files, but I get the error messages
below:
> load("rgraphfileload")
Error: bad restore file magic number (file may be corrupted)-- no data
loaded
Any idea why I would get the message above? I am using R version 1.6.1 on
a Solaris host.
Thanks,
Tony
Peter Dalgaard BSA
2003-Feb-12 21:54 UTC
[R] Three questions - loading(sourcing a file??), summaries to bitmaps, and error messages
Tony Vargas <tvargas at cisco.com> writes:> R helpers, > > I have three questions about R and was wondering if I could get some help. > > First, I am trying to send the output of a a summary command - > summary("info") to a bitmap file instead of the default device. Anybody > know how to send a summary to a bitmap device?Eh? Bitmap as in GIF/JPEG/... or what? Print to file is sink() if that's what you mean. You can also sink() to a text connection and use text() to put that on the graphics display (ruins tabular output, though).> Second - this question is more difficult. What I am trying to do is have > Perl (because I already have the data structures loaded into > hashes) generate a gigantic R file that I can then have R source, and then > parse. The output of the file(s) that I generate is below:> > my.badger.Sep.2002.cpu.utilization <- > read.table(file="/auto/solperf/tgu/ActiveParsedFiles/badger/Sep.2002/cpu.utilization", > sep="=", header=TRUE) names(my.badger.Sep.2002.cpu.utilization) > attach(my.badger.Sep.2002.cpu.utilization) Tony Vargas Cisco Systems > Engineering Computing Services (408) 525-4113 tvargas at cisco.com > my.balvenie.Sep.2002.cpu.utilization <- > read.table(file="/auto/solperf/tgu/ActiveParsedFiles/balvenie/Sep.2002/cpu.utilization", > sep="=", header=TRUE) names(my.balvenie.Sep.2002.cpu.utilization) > attach(my.balvenie.Sep.2002.cpu.utilization)You seem to need semicolons or \n mefore names(...) I assume that your address got in there with the aid of your emailer, not the Perl script?> I tried having R do a "load" on my files, but I get the error messages > below: > > > load("rgraphfileload") > Error: bad restore file magic number (file may be corrupted)-- no data > loaded > > Any idea why I would get the message above? I am using R version 1.6.1 on > a Solaris host.load() is for binary files made by save() or save.image(). Were you looking for source()? -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907