Hello,
I try to write a bash skript and I want to use the variables from my
bash skript into R. Ist that possible?
My bash skript creates lots of *.data files. I want forward these
files directly into R (in x.data.bz2), so that R creates a few data
automatically also in PDF.
For example:
bash created files: hello.data , world.data
how R created these files in pdf?
please look my plot.R
My plot.R:
source("plotter.R")
data <- loadResults("X.data.bz2")
plotColorMode <- cmColor
plotHideLegend <- FALSE
plotLegendSizeFactor <- 0.8
plotOwnOutput <- FALSE
plotFontFamily <- "Helvetica"
plotFontPointsize <- 22
plotWidth <- 10
plotHeight <- 10
plotConfidence <- 0.95
mainTitle <- "Deregistrations by Timeout"
xSet <- data$Steps[1]
xTitle <- "Steps"
ySet <- data$Time[s]
yTitle <- "Time]"
zSet <- data$Region
zTitle <- "Region{R}"
vSet <- c()
vTitle <- ""
wSet <- c()
wTitle <- ""
xAxisTicks <- getUsefulTicks(xSet) # Set to c() for automatic
setting
yAxisTicks <- getUsefulTicks(ySet) # Set to c() for automatic
setting
pdf("X.data.pdf")
plotstd3(mainTitle,
xTitle, yTitle, zTitle,
xSet, ySet, zSet,
vSet, wSet, vTitle, wTitle,
xAxisTicks=xAxisTicks,
yAxisTicks=yAxisTicks,
type="l",
colorMode=plotColorMode,
hideLegend=FALSE,
legendPos=c(1,1))
dev.off()
Thank you
Edwin
[[alternative HTML version deleted]]
Edwin Sendjaja said the following on 10/31/2007 3:26 PM:> Hello, > > I try to write a bash skript and I want to use the variables from my > bash skript into R. Ist that possible? > > > My bash skript creates lots of *.data files. I want forward these > files directly into R (in x.data.bz2), so that R creates a few data > automatically also in PDF. > ><irreproducible example snipped> When I do this, I export a variable in bash using 'export' then import the variable in R using Sys.getenv: ##R.sh #!/bin/bash export file="mydata" ## plot.R Sys.getenv("file") HTH, --sundar
Concatenate the file names into an environment variable (separated by a blank) and then read the environment variable in R and split the string apart into individual file names that you can loop on and create your PDF files. On 10/31/07, Edwin Sendjaja <edwin7 at gmx.net> wrote:> Hello, > > I try to write a bash skript and I want to use the variables from my > bash skript into R. Ist that possible? > > > My bash skript creates lots of *.data files. I want forward these > files directly into R (in x.data.bz2), so that R creates a few data > automatically also in PDF. > > > For example: > > bash created files: hello.data , world.data > how R created these files in pdf? > please look my plot.R > > > > My plot.R: > > > > source("plotter.R") > > data <- loadResults("X.data.bz2") > > plotColorMode <- cmColor > plotHideLegend <- FALSE > plotLegendSizeFactor <- 0.8 > plotOwnOutput <- FALSE > plotFontFamily <- "Helvetica" > plotFontPointsize <- 22 > plotWidth <- 10 > plotHeight <- 10 > plotConfidence <- 0.95 > > > mainTitle <- "Deregistrations by Timeout" > > xSet <- data$Steps[1] > xTitle <- "Steps" > > ySet <- data$Time[s] > yTitle <- "Time]" > > zSet <- data$Region > zTitle <- "Region{R}" > > vSet <- c() > vTitle <- "" > wSet <- c() > wTitle <- "" > > > xAxisTicks <- getUsefulTicks(xSet) # Set to c() for automatic > setting > yAxisTicks <- getUsefulTicks(ySet) # Set to c() for automatic > setting > > > pdf("X.data.pdf") > plotstd3(mainTitle, > xTitle, yTitle, zTitle, > xSet, ySet, zSet, > vSet, wSet, vTitle, wTitle, > xAxisTicks=xAxisTicks, > yAxisTicks=yAxisTicks, > type="l", > colorMode=plotColorMode, > hideLegend=FALSE, > legendPos=c(1,1)) > dev.off() > > > > Thank you > > Edwin > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve?