Problem generating an SVG file from a CSV file on the Mac
1. No reprex (we don't have WeightThru2018.csv) ! 2. Please post in plain text, not html . (did no har here, but could). 3. The following worked fine on my mac.
svg() plot(1:5) dev.off()
sessionInfo()
R version 3.6.1 (2019-07-05) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS Mojave 10.14.6 Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base ... etc. Cheers, Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Tue, Aug 20, 2019 at 3:18 PM Richard Fuhr <richard.fuhr at gmail.com> wrote:
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]]
_______________________________________________ R-SIG-Mac mailing list R-SIG-Mac at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-mac