I am trying to understand the function acf
stats:::acf shows me the function
I am having trouble understanding the usage "$acf" in the following
acf <- array(.C(R_acf, as.double(x), as.integer(sampleT),
as.integer(nser), as.integer(lag.max), as.integer(type ==
"correlation"), acf = double((lag.max + 1L) * nser *
nser), NAOK = TRUE)$acf, c(lag.max + 1L, nser, nser))
I interpret it as ... we are forming an array of dimensionality 3, and
the contents of the array come from invoking a C program R_acf while the
values of the 3 dimensions are lag.max + 1L, nser, and nser.
simplified acf<-array(.C(args)$acf, c(some dimensions))
Adding some spaces and line feeds to make it easier to read
acf <- array
(
.C(
R_acf,
as.double(x),
as.integer(sampleT),
as.integer(nser),
as.integer(lag.max),
as.integer(type == "correlation"),
acf = double((lag.max + 1L) * nser * nser),
NAOK = TRUE
)$acf,
c(lag.max + 1L, nser, nser)
)
R Language Definition section 3.4 "Indexing" explains that $ is used in
indexing.
But
The light is not coming on when I try to apply that knowledge to
understanding what is happening here.
Can anyone suggest a path out of the darkness?
Also, when I search my system for a file named R_acf, I dont find one.
I assume that this is because R_acf got task built into an executable
and my distribution has the executable? I got R from "yum install R" on
fedora linux. To see the source I apparently need to download a full
compilable distribution of R.
Dick
______________________________________________
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.