Displaying 20 results from an estimated 10000 matches similar to: "terminate R program when trying to access out-of-bounds array element?"
2005 Apr 13
0
terminate R program when trying to access out-of-bounds a rray element?
As Bert said, redefining functions like "[" is surely inadvisable, because
of possibility of breaking codes that depend on the intended behavior. This
is a language _feature_.
If the problem is indexing beyond array extent, just check for it: Are any
values that are going to be used for indexing larger than the length of the
object? E.g.,
if (any(idx > length(x)))
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
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 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
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 Nov 23
3
Infinite recursion in S3 methods crashes R on windows (related to PR#8203?)
Hi,
Infinite recursion in S3 methods seem to crash R on Windows 2000 (R
terminating with the ("Rgui.exe has generated errors...") message,
rather than throwing an error. This happens with both Rgui and Rterm.
The following toy example triggers this:
myf <- function(x, ...)
UseMethod("myf")
myf.default <- function(x, ...)
myf(x)
myf(1)
...R crashes...
Which I
2005 Mar 03
3
3d plot of regression squared error
Hi. I'm trying to create a 3d plot for a teaching example of finding a
least-squares estimate of the parameters to fit a line to some data. I
was hoping to get a nice plot with a clear, single minima where the
derivative of the surface is zero. No matter how much I tinker, I can't
seem to get a simple straightforward plot. Am I doing something wrong?
Thanks in anticipation,
Ross-c
x
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
2005 Apr 05
1
summing columns using partial labels
I have a dataset of the form
Year tosk.fai tosk.isd tosk.gr ....... tosk.total hysa.fai
hysa.isd ...
and so on. I want to sum all the columns using the first four letters in
the columns label(e.g. 'tosk', 'hysa' etc.). How can you do that? Also,
the sums should be without the '.total'column (e.g. 'tosk.total') as
this serves as a check that
2005 Apr 20
2
Suggestions for manipulating formula objects
I'm trying to manipulate/change a formula prior to passing it to another
function. A simplified example:
User passes formula to my function: y~x
My function does: lm(transform(y)~x)
Here, transform() is added to the model's response.
What is the best way to accomplish this?
2005 Apr 06
1
read.table with header and text data
Hi R!
I am reading in a text file which has one column of alpha data and 5 columns
of numeric data.
There is a header row.
I would like the alpha data column to just be character rather than factor.
Is there a way to do this, please? I'm thinking that it might be I() but
can't figure out exactly how.
Thanks,
Laura
mailto: lauraholt_983 at hotmail.com
R 2.0.1 Windows
2005 Apr 13
1
how to separate a string
hello,
i wonder how is string represent in R. if i have a string s= "hello", how can i refer to first character in the string s?
also if i have s1 = "hello.1", s2 = "ok.1", how can i separate the s1 into "hello" "1" and s2 into "ok" and "1"? I have tried to use the substring function, but i don't where i can get the index
2005 Apr 13
1
i param in "for" loop does not takes zeros?
Hi all
Is there any reason why the parameter i in a "for" loop ignores a value of
zero? For example
sim=c()
p=.2
for(i in 0:5)
{sim[i]=dbinom(i,5,p)
}
sim
[1] 0.40960 0.20480 0.05120 0.00640 0.00032
In this example the quantile i= 0 was ignored since
dbinom(0,5,p)
[1] 0.32768
The same behaviour occurs if I use a while loop to perform the same
calculation:
sim=c()
p=.2
i=0
2005 May 04
1
Questions about the intersection area under two kernel densities
Hi there,
I am working on a project which needs the value of the interaction area under two distributions( eatimated by kernel density estimators).
For example:
x<-rnorm(100,0,1)
y<-rnorm(100,0.2,1)
density(x) # This produces the summary of dependent variable and independent variable.
How can I get the individual values of variables and reform a curve to calculate the area under
2015 Oct 24
0
Bug#802870: xen: FTBFS: error: array subscript is above array bounds
Source: xen
Version: 4.4.1-9+deb8u1
Severity: serious
Justification: fails to build from source
Tags: sid stretch
User: reproducible-builds at lists.alioth.debian.org
Usertags: ftbfs
X-Debbugs-CC: reproducible-builds at lists.alioth.debian.org
Dear Maintainer,
The package fails to build:
symbols.c: In function ?symbols_lookup?:
symbols.c:23:61: error: array subscript is above array bounds
2007 Feb 14
0
[Bug 545] New: Array subscript is above array bounds
https://bugzilla.netfilter.org/bugzilla/show_bug.cgi?id=545
Summary: Array subscript is above array bounds
Product: iptables
Version: CVS (please indicate
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: ip6tables
AssignedTo: laforge@netfilter.org
2005 Apr 21
2
local average
Hello,
probably this isn't hard, but I can't get R to do this. Thanks for your
help!
Assume I have a matrix of two covariates:
n <- 1000
Y <- runif(n)
X <- runif(n,min=0,max=100)
data <- cbind(Y,X)
Now, I would like to compute the local average of Y for each X interval 0-1,
1-2, 2-3, ... 99-100. In other words, I would like to obtain 100 (local)
Ybars, one for each
2005 Apr 06
2
HP-UX and IRIX recent builds? Any other rare platforms?
I am revising the section in R-admin on platforms. When I asked about
locales earlier this year I got no reply about HP-UX and IRIX, so I will
presume that no one has built R on those OSes recently. If you have,
please send me the OS number and the flags you used.
Platforms where I have seen recent reports:
Linux
MacOS X
Solaris 8, 9, 10 (any Solaris 7 users please let me know)
AIX 5.1
2005 Apr 07
2
vectorized approach to cumulative sampling
Hi All,
I need to sample a vector ("old"), with replacement, up to the point
where my vector of samples ("new") sums to a predefined value
("target"), shortening the last sample if necessary so that the total
sum ("newsum") of the samples matches the predefined value.
While I can easily do this with a "while" loop (see below for example