Re: [R] Passing arguments to forked children

2009-07-11 Thread Godmar Back
On Fri, Jul 10, 2009 at 8:16 PM, nabble.30.miller_2...@spamgourmet.com 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

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. Marionmms...@comcast.net wrote: Hello, I am working on using if statements.  What  is the error message telling me here and

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 petr.pi...@precheza.cz 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 Rupertjasonkrup...@yahoo.com wrote: Maybe there is a great website out there or white paper that discusses

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 petr.pi...@precheza.cz 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

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 www...@gmail.comwrote: 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

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 www...@gmail.comwrote: 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

Re: [R] #INCLUDE

2009-07-08 Thread Godmar Back
?source ? On Wed, Jul 8, 2009 at 11:16 AM, Idgaradidga...@gmail.com 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?

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 0.857

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

2009-07-08 Thread Godmar Back
Statistician  CSOSA/Washington, DC           david.huf...@csosa.gov  - -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Godmar Back Sent: Wednesday, July 08, 2009 9:58 AM

Re: [R] Unix commands on R

2009-07-08 Thread Godmar Back
?system ?shQuote On Wed, Jul 8, 2009 at 4:36 PM, suman Duvvuruduvvuru.su...@gmail.com 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

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 Rupertjasonkrup...@yahoo.com 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,

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

[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]

[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

[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:

Re: [R] cor vs cor.test

2009-07-07 Thread Godmar Back
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 Godmar Back wrote: Hi, I am trying to use R for some survey analysis, and need to compute the significance of some correlations

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 Winsemiusdwinsem...@comcast.net 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)   #

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 Backgod...@gmail.com 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' led me to this: dummy - apply(AA, c(2), function

[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

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 Dallazuannawww...@gmail.com 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

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 Kimpelmwkim...@gmail.com wrote: Having

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

2009-07-07 Thread Godmar Back
On Tue, Jul 7, 2009 at 10:07 PM, Mark Kimpelmwkim...@gmail.com wrote: Switching to Sun definitely did not help, still no build with rJava, below is the output of  R CMD javareconf. You didn't switch. The paths /usr/lib/gcj-4.3.-90 etc. - any path containing 'gcj' - indicates you're using GNU's