[R-SIG-Mac] Problem generating an SVG file from a CSV file on the Mac

Richard Fuhr r|ch@rd@|uhr @end|ng |rom gm@||@com
Wed Aug 21 00:17:42 CEST 2019


I have encountered a problem generating an SVG file from a CSV file using R
on the Mac.
When I invoke the exact same script on two different Linux machines things
work fine.
Here is the script

Sys.setenv(TZ="US/Pacific")
w<-read.csv("WeightThru2018.csv")
x<-as.Date(w$Date, "%m/%d/%y")
y<-w$Weight
For some reason svg combined with plot do not work on the Mac
svg("WeightThrough2018.svg")
plot(x,y, type="l")
pdf("WeightThrough2018.pdf")
plot(x,y, type="l")
jpeg("WeightThrough2018.jpg")
plot(x,y, type="l")
png("WeightThrough2018.png")
plot(x,y, type="l")
dev.off()

The file, WeightThru2018.csv, consists of lines, each of which has a date
followed by a weight.
Here is the very beginning of the file

Date,Weight
6/4/00,189
6/5/00,191
6/6/00,191
6/7/00,191
6/9/00,190

When I run the script on the Mac, the system hangs with the first plot
command (after the call to the sag function)
When I comment out the line with the svg function and the first plot
command, things run fine on the Mac and the PDG, JPG and PNG files are
generated.

When I run the script with no lines commented out on my Linux machines,
things work fine.

When I enter the commands interactively on the Mac, the system hangs (no
error messages) with the first plot command.

On the Mac I did verify that the variables x and y were being extracted
properly.

Has anyone else out there tried to generate an SVG file that was a plot of
(x,y) data?

I also found that, on the Mac, just running the plot command without
preceding it will a call to sag, pdf, jpeg, or plot, worked fine and I
could see the plot.

SVG is a nice format, and I would like to be able to generate SVG files on
the Mac.

	[[alternative HTML version deleted]]



More information about the R-SIG-Mac mailing list