Created
January 22, 2012 06:39
-
-
Save timrandg/1655958 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rinruby' | |
def point_plot(data_dir, data_file, pdf_file) | |
data_in = File.join(data_dir, data_file) | |
pdf = File.join(data_dir, pdf_file) | |
r = RinRuby.new(:echo=>false) | |
puts "Messages From R console:" | |
r.eval <<EOF | |
pdf(#{pdf.inspect}, onefile = TRUE) | |
library('ggplot2') | |
data <-read.table(#{data_in.inspect}) | |
qplot(row(data), data$V1,geom=c('point', 'path')) | |
dev.off() | |
EOF | |
puts "Opening #{pdf}" | |
system("open #{pdf}") | |
end | |
data_dir = '/Users/Tim/Library/Containers/com.apple.TextEdit/Data/Desktop/NXT_Data' | |
data_file = 'DLog.txt' | |
pdf_file = 'out_file.pdf' | |
point_plot(data_dir, data_file, pdf_file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment