On 24/11/2019 6:06 p.m., [email protected] wrote:
I have made a list in which each element is a function. If I print
individual elements of the list, then the function code is shown along
with embedded comments. However, if I print the list or sublist, then the
function code is shown without comments. Why (and how) are the comments
hidden?
Hi Mik. I see the same behaviour as Bert, not what you see.
Generally the comments will be shown if the "srcref" attribute is
attached to the function, and it is a valid one. That shouldn't change
between looking at flist[[3]] and flist[3]. If it's not there or not
valid, you'll see a deparsed version of the function; that's what your
flist[3]$btv looks like.
It's possible this is R 3.3.2-specific; that's a relatively old version
now, but I don't know of any change that would cause this. Can you show
us the code that you used to create flist, or enough of it to show this
behaviour? Showing us (or me privately) dput(flist) might be enough to
see what's going on.
Duncan Murdoch
flist[[3]]
function(y,brackets,rates){
# Calculates before-tax income required to realized value y
ints<-c(0,cumsum(diff(brackets)*rates[1:(length(rates)-1)]))-brackets*rates
x<-(y+ints)/(1-rates)
x[sum(x>brackets)]
}
flist[3]
$btv
function (y, brackets, rates)
{
ints <- c(0, cumsum(diff(brackets) * rates[1:(length(rates) -
1)])) - brackets * rates
x <- (y + ints)/(1 - rates)
x[sum(x > brackets)]
}
I am running R 3.3.2 on Mac OS X 10.10.5
Mik Bickis
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
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.
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
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.