[R] Working directories... Again

2010-02-26 Thread Allen L

Dear R forum,
I've looked many places for this and figure there must be an easy way to
implement.

I want to set the working directory in my script to the place where the R
code is located.
Something like: 
setwd(directory where this script is found).

Thanks!
-Allen

-- 
View this message in context: 
http://n4.nabble.com/Working-directories-Again-tp1571058p1571058.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] Lyapunov matrix equation

2010-01-06 Thread Allen L

Dear R forumers,
Wondering if anyone knows of a package that can solve the lyapunov matrix
equation
C=ACA^T + B
in R? Currently I am exporting to Mathematica, solving and bringing the
results back in, but this is not ideal. Can R do this?
Thanks in advance,
Allen
-- 
View this message in context: 
http://n4.nabble.com/Lyapunov-matrix-equation-tp1008389p1008389.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] Class attributes

2009-12-04 Thread Allen L

Dear R forum,
I want to replace all the elements in a data frame (dd) which match the
character x with 0.
What's the most elegant way of doing this (there must be an easy way which
I've missed)? I settled on the following loop:

for(i in 5:12){# These are the column of dd I am interested
in
dd[which(dd[,i]==x),i]-0
}

The problem with this is that the columns which used to contain x are
still considered factors and I am unable to coerce them into numeric:

 mean.species.biomass-colMeans(as.numeric(dd.p[,5:12]))
Error in inherits(x, data.frame) : 
  (list) object cannot be coerced to type 'double'

I'm tried unclassing  reclassing, other functions etc. but nothing seems to
work. What is wrong?
Thanks in advance,
Allen
-- 
View this message in context: 
http://n4.nabble.com/Class-attributes-tp948693p948693.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.