Displaying 20 results from an estimated 22 matches for "trailingon".
Did you mean:
trailing
2011 Apr 09
1
How do I make this faster?
...that somebody will be able
to figure out how to make it faster, either through parallelisation, or by
making changes. I've marked the places where Rprof showed me it was slowing
down:
currencyCorrelation <- function(lagtime = 1) {
require(quantmod)
dataTrack <- getSymbols(commandArgs(trailingOnly=T)[1], from='2009-11-21',
to='2011-04-03')
stockData <- get(dataTrack)
currencies <- row.names(oanda.currencies[grep(pattern='oz.', fixed=T, x
=as.vector(oanda.currencies$oanda.df.1.length.oanda.df...2....1.)) == F])
correlations <- vector()
values <- l...
2009 Aug 28
1
How to convert a string passed as an argument to a vector?
Hi,
$ cat commandArgs.R
args=commandArgs(trailingOnly=TRUE)
args[1]+10
I have the above code. But the following command line gives me an error. I
am wondering what is the correct way to convert a string to a vector?
$ Rscript commandArgs.R 1:3
> args=commandArgs(trailingOnly=TRUE)
> args[1]+10
Error in args[1] + 10 : non-numeric argument to...
2016 Oct 29
3
pasar argumentos de consola a un script de R que contiene source
Hola.
Tengo un script con la siguiente estructura.
#!/usr/bin/env Rscript
args = commandArgs(trailingOnly=TRUE)
source("carga-datos.R")
source("modelo.R")
y quiero llamar a mi script desde consola con
Rscript --vanilla miscript.R datos1.csv
De forma que se guarde como argumento el nombre del fichero que quiero
cargar y se pase a al script carga-datos.R. El problema es que a...
2011 Jul 02
5
%dopar% parallel processing experiment
dear R experts---
I am experimenting with multicore processing, so far with pretty
disappointing results. Here is my simple example:
A <- 100000
randvalues <- abs(rnorm(A))
minfn <- function( x, i ) { log(abs(x))+x^3+i/A+randvalues[i] } ?## an
arbitrary function
ARGV <- commandArgs(trailingOnly=TRUE)
if (ARGV[1] == "do-onecore") {
?library(foreach)
?discard <- foreach(i = 1:A) %do% uniroot( minfn, c(1e-20,9e20), i ) } else
if (ARGV[1] == "do-multicore") {
?library(doMC)
?registerDoMC()
?cat("You have", getDoParWorkers(), "cores\n")...
2009 Nov 10
1
Is it possible to detect whether running as Rscript?
...from Rscript, but not to run if the same file is being source()d,
or submitted via ESS, etc. As a gloss I would like to write a file
that looks somewhat like:
#!/usr/bin/env Rscript
my.func <- function(...) {
#do something...
}
if ( #is.running.Rscript# ) {
do.call(my.func, commandArgs(trailingOnly=TRUE))
}
If it helps, I'm thinking of something similar to the Python idiom of
writing
#!/usr/bin/env python
#class, function definitions
if (__name__=='__main__'):
#code to be executed when running this file directly
The intent is to use R's debugging facilities to help s...
2011 Mar 14
1
Rscript, hashbang, and arguments
...I know Rscript has the option to run in --vanilla. Where exactly do I
insert the --vanilla option? When I do something like this:
./nameOfRScript --vanilla arg1 arg2 ...
And I try to access the commandArgs, the first argument is --vanilla which
isn't what I want. I tried to do commandArgs(trailingOnly=TRUE) with
./nameOfRScript --vanilla --args arg1 arg2 ...
But I sitll have the first argument as --vanilla. Does anyone know how to
get around this? Thanks,
Fong
[[alternative HTML version deleted]]
2008 Oct 15
1
Can R scripts executed in batch mode take a commandline argument?
I have examined the documentation for batch mode use of R:
R CMD BATCH [options] infile [outfile]
The documentation for this seems rather spartan.
Running "R CMD BATCH --help" gives me info on only two options: one for
getting help and the other to get the version. I see, further on, that
there are options for retoring and saving sessions (which I do not need to
do in this case),
2014 Jul 01
1
combining data from multiple read.delim() invocations.
Is there a better way to do the following? I have data in a number of tab
delimited files. I am using read.delim() to read them, in a loop. I am
invoking my code on Linux Fedora 20, from the BASH command line, using
Rscript. The code I'm using looks like:
arguments <- commandArgs(trailingOnly=TRUE);
# initialize the capped_data data.frame
capped_data <- data.frame(lpar="NULL",
started=Sys.time(),
ended=Sys.time(),
stringsAsFactors=FALSE);
# and empty it.
capped_data <- capped_data[-1,];
#
# Read in th...
2011 Nov 28
1
Running Shell Script with R
...having some trouble getting my shell script to work. I've checked out the
Intro to R Manual and a host of other websites, but I still can't get the
script to work when I submit the job to the cluster.
Here is my main R code:
##Load Libraries
##...
## Load Time Data
Args <- commandArgs(trailingOnly = TRUE);
print(Args);
timeDat <- read.flowSet(files=NULL, path=Args[1]);
save(timeDat,file = Args[2]);
Here is my shell script file
#!/bin/bash
#$ -cwd
#$ -q all.q
R --slave --vanilla --file="/home/jpura/Desktop/FDA_Trial_Data/testscript.R"
--args "/home/jpura/Desktop/FDA_Tr...
2009 Jul 13
2
how to run a R program with input arguments
I am a beginner in R and know only a little about it yet. I have a script
written in R language, named as "a.txt" for example. I am using a Linux
machine, at present I only know that I can type "R" in the terminal and then
copy-paste the content in "a.txt" to the R's interface to execute the
program. However, I want to know if there is any method that allows me to
2010 Sep 13
4
Problem with WARNING...headers with CRLF line endings
Dear all,
When running R CMD check on Windows XP to test my package I get the
following warning message:
"* checking line endings in C/C++/Fortran sources/headers ... WARNING
Found the following sources/headers with CR or CRLF line endings:
src/xpsDict.h"
The problem is that this file is created by the compiler AUTOMATICALLY
during the compilation process, and since the file is
2009 Aug 20
1
Command line option to an R script running through Rscript
Hi,
I know that I can use the following script to get the command line
options for an R script. But the output shows two many irrelevant
arguments. For example, I only want to pass "a", "b" and "c" to the
script. The first 5 elements in the variable 'args' are not what I
want. I am wondering what is the correct way to pass command line
options to an R script.
2013 Mar 24
0
Rscript does not load/capture all shell arguments
...IS_OPT_OUTMAP_GLM $GIS_OPT_FSTATS $GIS_FLAG_M $GIS_OPT_SPP
$GIS_OPT_SPA $GIS_OPT_FAM $GIS_OPT_TERMS $GIS_FLAG_Q $GIS_OPT_OUTMAP_PROJ
$GIS_OPT_ENV_PROJ $GIS_OPT_KFOLD $GIS_OPT_SFOLD
In the R script, I use the commandArgs function to capture the arguments
supplied to Rscript:
args <- commandArgs(trailingOnly=TRUE)
The problem is that args only contains the first 12 arguments (up to and
including $GIS_OPT_OUTPUT_PROJ).
I also tried using a call to R instead of Rscript:
R --no-save --no-restore --no-site-file --no-init-file --args
"${GIS_OPT_INMAP}" "${GIS_OPT_PRES}" "${GIS_...
2008 Jul 01
4
passing a variable at the command line
Dear R People:
I have used
./R --no-save -q -f e.in >stuff.out
with great success on SUSE10.1 with R-2.7.1.
My question is, please: is there a way to pass in a variable to the
e.in file? I'm fairly sure that the answer is no, but thought I'd
double check.
Thanks in advance,
Sincerely,
Erin
--
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
2007 May 16
2
Running R function as a Batch process
Hi,
I am struggling with using R CMD BATCH command. Kindly suggest solution to
the following problem.
I have a function named CinC with accept two input parameters. This can be
shown as:
CinC <- function(start, end)
where start and end both are character strings.
Please suggest me how can I run this function using command R CMD BATCH.
Currently I am trying to do like this -> R CMD
2011 Aug 23
1
Passing parameters
...f the required packages
print("Loading Libraries??")
library(intamap) # also loads sp, gstat, rgdal, akima, automap, mvtnorm,
MASS, evd, lattice
library(extremevalues)
library(fBasics)
library(geoR)
library(graphics)
library(plotrix)
################### get arguments
Args = commandArgs(trailingOnly=TRUE)
print(Args)
currentWS_RCMD = Args[1]
indata_RCMD = sub(".shp","",Args[2], ignore.case = TRUE) # strip extension
from the file name
R_output_RCMD = Args[3]
###################################################
In the Arc Script tool, the parameters are:
currentWS: Data...
2017 Jun 12
2
Bucle for que se salte los errores
He encontrado la respuesta. EL ejemplo que puse era trivial, ya que es obvio que if(i ==0) entonces next, pero me referia a sin saber si va a ser error el modelo o no.
Para esto he encontrado la solución
for(i in -3:3){
tryCatch({
z<-1/i
> z<-z*z
> modelo<-lm(z~1)
}, error=function(e){print("es un error"})
}
Gracias de todas maneras!!!!!
Jesús
2010 Mar 29
3
one way to write scripts in R
...tion above, with the pipe and
tail combo.
# This file becomes the program read into R. If it is set chmod+x then you
can execute this file.
pp=function(...) paste(sep="",...)
script="scriptdemo.rsh"
usage=pp(script,": put help info here")
argv = commandArgs(trailingOnly=TRUE)
# --help
if(any(argv=="--help")) {
cat(usage)
quit(save="no",status=0)
}
# 2nd point of note: this is how to read stdin inside a script:
#
# slurp in all the input
r=readLines("stdin")
bad=grep("^#",r) # remove comments
# w...
2009 Feb 17
3
R scripts and parameters
A couple of weeks ago I asked how it is possible to run an R script (not a function) passing some parameters.
Someone suggested the function "commandArgs()".
I read the on-line help and found no clarifying example. Therefore I do not know how to use it appropriately.
I noticed this function returns the pathname of the R executable which is not what I need.
I meant to ask if it is
2017 Jul 18
4
Creating/Reading a complex string in R
Thanks for your pointer.
Is there any way in R how to replace " ' " with " /' " programmatically?
My actual string is quite lengthy, so changing it manually may not be
possible. I am aware of gsub() function, however not sure I can apply
it directly on my original string.
Regards,
On Tue, Jul 18, 2017 at 10:27 PM, John McKown
<john.archie.mckown at gmail.com>