Re: [R] Passing arguments to forked children

2009-07-11 Thread Godmar Back
On Fri, Jul 10, 2009 at 8:16 PM, wrote: > Hi - > >    I have attempted to use the fork::fork() function to perform > parallel processing. However, the child R function called needs to > know a given set of parameters to complete its task. Specifically, I > iterate through a vector, and output valu

Re: [R] IF STATEMENTS

2009-07-10 Thread Godmar Back
It thinks twoSided is a variable, but you've never assigned such a variable. Use "twoSided" instead - that's a string constant. On Fri, Jul 10, 2009 at 4:04 PM, Mary A. Marion wrote: > Hello, > > I am working on using if statements.  What  is the error message telling me > here and how do I correc

Re: [R] Best way to export values from a function?

2009-07-09 Thread Godmar Back
On Thu, Jul 9, 2009 at 4:50 AM, Petr PIKAL wrote: > Hi > > r-help-boun...@r-project.org napsal dne 09.07.2009 02:57:33: > > > On Wed, Jul 8, 2009 at 8:34 PM, Jason Rupert > wrote: > > > > > > Maybe there is a great website out there or white paper that discusses > this > > but again my Google ski

Re: [R] Mysteriously vanishing LD_LIBRARY_PATH

2009-07-08 Thread Godmar Back
R respects LD_LIBRARY_PATH, see /usr/lib/R/etc/ldpaths where it prepends its own path to any value in the environment when R is invoked: if test -z "${LD_LIBRARY_PATH}"; then LD_LIBRARY_PATH="${R_LD_LIBRARY_PATH}" else LD_LIBRARY_PATH="${R_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}" fi export LD_LIBR

Re: [R] Best way to export values from a function?

2009-07-08 Thread Godmar Back
On Wed, Jul 8, 2009 at 8:34 PM, Jason Rupert wrote: > > Maybe there is a great website out there or white paper that discusses this > but again my Google skills (or lack there of) let me down. Yeah, R is difficult to search for - I've had partial success with rseek.org, though. > > I would like

Re: [R] Unix commands on R

2009-07-08 Thread Godmar Back
?system ?shQuote On Wed, Jul 8, 2009 at 4:36 PM, suman Duvvuru wrote: > I am using R on unix. While in R how do I execute the unix shell commands? > Is there a way to do it? I am executing a function in R and the matrix > resulting from the function has to be passed on as an input to unix command.

Re: [R] error: no such index at level 2

2009-07-08 Thread Godmar Back
crossRsorted[,1] ]) >  [1] 15750 > > I must be missing something. > > -- >  David > >  - >  David Huffer, Ph.D.               Senior Statistician >  CSOSA/Washington, DC           david.huf...@csosa.gov >  ------

Re: [R] Formatting a Table

2009-07-08 Thread Godmar Back
You could use 'cat(sprintf())', C-style: > for (N in seq(2,10,2)) + {if (N==2){cat(sprintf("%5d", T(N,Lc)*100),"\n")}else{cat(sprintf("%5.3f", T(N,Lc)), "\n")}} 707580858995 0.490 0.562 0.640 0.722 0.810 0.902 0.398 0.475 0.562 0.657 0.762 0.876 0.343 0.422 0.512 0.614 0.729

Re: [R] #INCLUDE

2009-07-08 Thread Godmar Back
?source ? On Wed, Jul 8, 2009 at 11:16 AM, Idgarad wrote: > What is R's equivalent to a C-like #include to incorporate external files. I > have a 2k line function that is generated and need to include it at runtime > but not manage it as a package (as it changes hourly.) Any ideas? > >        [[al

Re: [R] error: no such index at level 2

2009-07-08 Thread Godmar Back
On Wed, Jul 8, 2009 at 9:40 AM, Henrique Dallazuanna wrote: > Its because '[[' accept only element, so you need use '[': > > q[crossRsorted[,1]] > > Henrique, I figured out what q[crossRsorted[,1]] does - it produces q[i] for all i in crossRsorted[,1]. Ok. Since a given index 'k' of q[[k]] can oc

Re: [R] error: no such index at level 2

2009-07-08 Thread Godmar Back
On Wed, Jul 8, 2009 at 9:40 AM, Henrique Dallazuanna wrote: > Its because '[[' accept only element, so you need use '[': > > q[crossRsorted[,1]] > This appears to be doing something different. For instance, my 'q' has 165 components, but what you suggest has 15750: > length(q) [1] 165 > length(q[

Re: [R] error: no such index at level 2

2009-07-08 Thread Godmar Back
On Wed, Jul 8, 2009 at 4:22 AM, Petr PIKAL wrote: > Hi > > r-help-boun...@r-project.org napsal dne 07.07.2009 19:06:17: > > > Hi, > > > > I am confused about how to select elements from a list. > > > > I'm trying to select all rows of a table 'crossRsorted' such that the > > mean of a related vec

Re: [R] can't get rJava to install on Linux

2009-07-07 Thread Godmar Back
ter Court, Westfield, IN  46074 > > (317) 490-5129 Work, & Mobile & VoiceMail > > "The real problem is not whether machines think but whether men do." > -- B. F. Skinner > ** > > > > On Tue, Jul 7, 2009 at 9:43 PM, Godmar Bac

Re: [R] can't get rJava to install on Linux

2009-07-07 Thread Godmar Back
This is just a guess: looks like you have GNU's Java version in your path (aka "gcj"). Perhaps rJava relies on Sun's Java version. If so, install Sun's Java first. apt-get install sun-java6-jdk might do it. - Godmar On Tue, Jul 7, 2009 at 9:28 PM, Mark Kimpel wrote: > Having difficulties getti

Re: [R] how to count number of elements in a vector that are not NA ?

2009-07-07 Thread Godmar Back
Thank you for the many replies! This is really a very friendly and helpful community! On Tue, Jul 7, 2009 at 3:06 PM, Henrique Dallazuanna wrote: > another option should be: > > length(na.omit(v)) > I think the above is what I was looking for since, presumably, it uses the very same test as other

[R] how to count number of elements in a vector that are not NA ?

2009-07-07 Thread Godmar Back
Hi, is there a simpler way to count the number of elements in a vector that are not NA than this: countN <- function (v) { return (Reduce(function (x, y) x + y, ifelse(is.na(v), 0, 1))) } ? - Godmar __ R-help@r-project.org mailing list https://s

Re: [R] how to get R to print only one column per line when outputting a matrix?

2009-07-07 Thread Godmar Back
On Tue, Jul 7, 2009 at 1:22 PM, Godmar Back wrote: > >> apply(AA, c(2,1), cat, "\n") > Error in cat(list(...), file, sep, fill, labels, append) : >  argument 1 (type 'list') cannot be handled by 'cat' > ps: but your idea of using 'apply'

Re: [R] how to get R to print only one column per line when outputting a matrix?

2009-07-07 Thread Godmar Back
On Tue, Jul 7, 2009 at 12:20 PM, David Winsemius wrote: > It looks like you are printing a matrix and that you want to print all rows > of the first column before all rows of the second column. Apply should do > it. Assume the matrix is named "AA" > > apply(AA, c(2,1), cat, "\n")   # the \n is the

Re: [R] cor vs cor.test

2009-07-07 Thread Godmar Back
lete > cases are used. The formula method does have an argument na.action > and it works just fine for me. > Try getOption('na.action') and you'll probably find that it is set >                  ^^ > to 'na.omit'. > >  -Peter Ehlers > > Godm

[R] error: no such index at level 2

2009-07-07 Thread Godmar Back
Hi, I am confused about how to select elements from a list. I'm trying to select all rows of a table 'crossRsorted' such that the mean of a related vector is > 0. The related vector is accessible as a list element l[[i]] where i is the row index. I thought this would work: > crossRsorted[mean(

[R] cor vs cor.test

2009-07-07 Thread Godmar Back
Hi, I am trying to use R for some survey analysis, and need to compute the significance of some correlations. I read the man pages for cor and cor.test, but I am confused about - whether these functions are intended to work the same way - about how these functions handle NA values - whether cor.t

[R] how to get R to print only one column per line when outputting a matrix?

2009-07-07 Thread Godmar Back
Hi, I'm trying to make it easier for my survey evaluators to read the results of my survey analysis. To that end, I'd like to suppress R's habit of filling every line up to width columns. How do I do that? For instance, using 'print()', R outputs something like: [,1] [,