[R] R in batch mode: cannot mkdir R_TempDir

2012-11-14 Thread capy_bara
Dear all,
I am trying to run a simple R script in batch mode on a cluster.  Running a
simple test script with 

"R CMD BATCH test.R  test.Rout" 

works fine, but as soon as I submit the very same command to the queue and
the job gets sent to a node, the following error is written to test.Rout:

Fatal error: cannot mkdir R_TempDir

I set the environment variables TEMP, TMP and TMPDIR to /tmp/ and I also
make sure that all environment variables are set on the nodes. Running the R
command "tempdir()" on a node returns something like "/tmp/RtmpadvdoQ". I
also made sure that the /tmp/ directory is readable and writable on all
nodes. 
I know that this question might be more cluster-specific (I'm running
scientific linux) than R specific and my example is hard to reproduce.
However, maybe someone encountered similar problems.  Is it maybe possible
to specify the tempdir in an argument to R CMD BATCH? 

Many thanks in advance,

Hannes





--
View this message in context: 
http://r.789695.n4.nabble.com/R-in-batch-mode-cannot-mkdir-R-TempDir-tp4649503.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


[R] multi-panel figure: overall title for each row

2012-10-23 Thread capy_bara
Dear all,
I have a 3x2 plot and in addition to the title of the individual plots I
would like to have an overall title
for each row.  I managed to get an overall title for the whole plot matrix
with mtext:

par(mfrow=(c(3,2)), mar=c(6.4,4.5,4.2, 1.8), oma=c(0,0,3,0))
for (i in 1:6)
  barplot(sample(1:10,5), main=paste("Plot #",i))
mtext("Overall Title Row 1", outer=TRUE)

but I  cannot put an overall title in the middle above the titles of the
plots in the second or third row. 
If I use mtext within the loop, I can only add another title above an
individual plot.

I hope someone can help me, many thanks in advance

Hannes




--
View this message in context: 
http://r.789695.n4.nabble.com/multi-panel-figure-overall-title-for-each-row-tp4647148.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


[R] splitting a vector

2012-08-01 Thread capy_bara
Hello,

I have a vector with positive integer numbers, e.g. 

> numbers <- c(1,2,1,2,3,4,5)

and want to split the vector whenever an element in the vector is smaller or
equal to its predecessor. 
Hence I want to obtain two vectors: c(1,2) and c(1,2,3,4,5).
I tried with which(), but it is not so elegant:

> numbers[1:(which(numbers<=numbers[1])[2]-1)]
> numbers[which(numbers<=numbers[1])[2]:length(numbers)]

Sure I can do it with a for-loop, but that seems a bit tedious for that
small problem. 
Does maybe anyone know a simple and elegant solution for this? I'm searching
for a general solution, since
my vector may change and maybe be split into more than two vectors, e.g.
give five vectors for c(1,1,2,3,4,5,1,2,3,2,3,4,5,6,4,5).

Many thanks in advance,

Hannes







--
View this message in context: 
http://r.789695.n4.nabble.com/splitting-a-vector-tp4638675.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] convex nonnegative basis vectors in nullspace of matrix

2012-04-12 Thread capy_bara
Hi
the solution with linear programming works very well!
Even if I take more 'realistic' matrices with dimensions of about  25x60,
the calculation of the basis goes well (if I increase the number of
iterations to 1000).
Meanwhile I also found an algorithm for an exact calculation of the extreme
rays of the cone (Appendix in
http://www.sciencedirect.com/science/article/pii/S0022519300910737).
When I have time I will try to implement this solution as well and compare
the performances, but the one I have now works fine in my application.
Many thanks,
Hannes

--
View this message in context: 
http://r.789695.n4.nabble.com/convex-nonnegative-basis-vectors-in-nullspace-of-matrix-tp4548822p4552371.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


[R] convex nonnegative basis vectors in nullspace of matrix

2012-04-11 Thread capy_bara
Dear all,

I want to explore the nullspace of a matrix S: I currently use the function
Null from the MASS package to get a basis for the null space:
> S  = matrix(nrow=3, ncol=5, c(1,0,0,-1,1,1,1,-1,-1,0,-1,0,0,0,-1)); S
> MASS::Null(t(S))
My problem is that I actually need a nonnegative basis for the null space of
S.
There should be a unique set of convex basis vectors spanning a vector space
in which each vector v satisfies sum (S %*%  v) == 0 and min(v)>=0. 
Is there maybe an R function that can calculate that for me?
I would appreciate any help, 
Thanks in advance,

Hannes


--
View this message in context: 
http://r.789695.n4.nabble.com/convex-nonnegative-basis-vectors-in-nullspace-of-matrix-tp4548822p4548822.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] single, double or no quotes in expression

2012-03-15 Thread capy_bara
Many thanks,
"parse" is exactly what I was looking for!!

Hannes

--
View this message in context: 
http://r.789695.n4.nabble.com/single-double-or-no-quotes-in-expression-tp4475247p4475475.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


[R] single, double or no quotes in expression

2012-03-15 Thread capy_bara
Dear all,

I am confused about how to create an expression. I use a package (rsbml)
which uses expressions and seems to make a difference if there is a quote
around the expression or not. 

For example, package works with expressions such as
> expression(A + B)
but not with
> expression("A + B")

I now have a set of math expressions represented as strings, something like
this:
> rhs_eq<- c("0", "A + B", "B * (2+C)")
and want to make expressions without quotes out of it.

I tried 
> lapply(lapply(rhs_eq, as.symbol), as.expression)
which only turns the double quotes into single quotes, but does not remove
the quotes.
I also played around with as.formula, as.name, quote and enquote, but had no
success.  

Does anyone know about quotes in the expression data type?

Thanks in advance,

Hannes


--
View this message in context: 
http://r.789695.n4.nabble.com/single-double-or-no-quotes-in-expression-tp4475247p4475247.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.