search for: rvivekrao

Displaying 8 results from an estimated 8 matches for "rvivekrao".

2005 Apr 13
3
terminate R program when trying to access out-of-bounds array element?
I want R to stop running a script (after printing an error message) when an array subscript larger than the length of the array is used, for example x = c(1) print(x[2]) rather than printing NA, since trying to access such an element may indicate an error in my program. Is there a way to get this behavior in R? Explicit testing with the is.na() function everywhere does not seem like a good
2005 Apr 12
8
removing characters from a string
Is there a simple way in R to remove all characters from a string other than those in a specified set? For example, I want to keep only the digits 0-9 in a string. In general, I have found the string handling abilities of R a bit limited. (Of course it's great for stats in general). Is there a good reference on this? Or should R programmers dump their output to a text file and use something
2005 Apr 13
1
Why is 1 a double?
Based on examples in R books and the syntax of other programming languages, I expected that n <- 10 assigns the integer 10 to n, but typeof(n) is actually a double. The subscripting expression x[1] is valid, but sprintf("\n %d",1) is not, giving the error Error in sprintf("\n %d", 1) : use format %f, %e or %g for numeric objects One must use instead sprintf("\n
2005 Apr 13
0
terminate R program when trying to access out-of-bounds a rray element?
...c, > logical and character indices can all be used to index vectors, and > these have recycling rules, etc), this is probably much more work than > a few checks in your code where an NA would actually indicate an > error. > > Cheers, > Rich > > On 4/14/05, Vivek Rao <rvivekrao at yahoo.com> wrote: > > I want R to stop running a script (after printing an > > error message) when an array subscript larger than the > > length of the array is used, for example > > > > x = c(1) > > print(x[2]) > > > > rather than printing NA...
2005 Apr 11
2
static analysis tools for R code?
An R script will terminate when one tries to use an undefined variable, with a message such as Error in print(x) : Object "x" not found This run-time error might occur after the script has already been running for some time. In some cases it would be nice to get such warnings before the script is run, just as a syntax error caused by a missing parenthesis is caught. Are there any
2007 Apr 11
3
Fortran coding standards
I have some comments on the Fortran code in the fseries package in file 4A-GarchModelling.f , especially the subroutine GARCHFIT and function DSNORM. I appended the code to the end of an earlier message, but it was rejected by some rule. Let me first say that I am grateful that packages for financial econometrics exist in R. Fortran 77 had PARAMETERs, and PARAMETERs equal to 99999 and 200 should
2005 Apr 08
1
restrict namespace inside functions?
Is there a way to exclude from the namespace all variables other than function arguments and local variables? For example, I would like the following code a = 2.0 mult <- function(x) { pi = 3.14 return(pi*a*x) } print(mult(10.0)) to say "a not found" rather than using a = 2.0 inside function mult. Thanks. Vivek Rao
2005 Jul 16
2
topical guide to R packages
I would like to see R packages arranged by topic. CRAN Task Views are at http://lib.stat.cmu.edu/R/CRAN/src/contrib/Views/ , but I'd like something more detailed. For example, the IMSL Fortran library, version 4 is easy to navigate and has procedures arranged according to following topics: Basic Statistics Regression Correlation Analysis of Variance Categorical and Discrete