Displaying 10 results from an estimated 10 matches for "wholesrcref".
2018 Jun 18
2
incomplete results from as.character.srcref() in some cases involving quote()
Hi,
The result of as,character() on 'srcref' objects doesn't have the closing ')' in some cases involving 'quote':
> e4 <- quote({2+2})
> class(attr(e4, "wholeSrcref"))
[1] "srcref"
> as.character(attr(e4, "wholeSrcref"))
[1] "e4 <- quote({2+2}"
As a result printing the object also lacks it and gives an incomplete expression:
> attr(e4, "wholeSrcref")
e4 <- quote({2+2}
It seems that it is the top level...
2018 Jun 20
0
incomplete results from as.character.srcref() in some cases involving quote()
wholeSrcref attribute is documented in ?parse to be the source reference
corresponding to the already parsed text. The implementation in the
parser matches the documentation - the code stops at the last
byte/character of the expression, that is, on the closing brace - which
is the "already parsed text...
2011 Jan 05
2
convert expressions to characters
Hi,
Suppose I have
x = parse(text = "
{y=50+50+50#'asfasf'
}
")
now x is an expression with some src attributes.
> x
expression({y=50+50+50#'asfasf'
})
attr(,"srcfile")
<text>
attr(,"wholeSrcref")
{y=50+50+50#'asfasf'
}
My question is, how can I get my string back (the string passed to
parse() as the text argument)?
> as.character(x)
[1] "{"
as.character() only returns "{".
> as.character(expression({1}))
[1] "{"
> as.character(expre...
2017 Dec 11
1
possible bug in utils::removeSource - NULL argument is silently dropped
...t;- recurse(part[[i]])
it should be (IMHO):
part[i] <- list(recurse(part[[i]]))
---
# create a function with the above patch
rmSource <- function (fn) {
stopifnot(is.function(fn))
if (is.primitive(fn))
return(fn)
attr(fn, "srcref") <- NULL
attr(body(fn), "wholeSrcref") <- NULL
attr(body(fn), "srcfile") <- NULL
recurse <- function(part) {
if (is.name(part))
return(part)
attr(part, "srcref") <- NULL
attr(part, "wholeSrcref") <- NULL
attr(part, "srcfile") <- NULL
i...
2011 Apr 22
3
Parametrized object name in Save statement
...rse(text=paste("save(cart_", args, ", file=file)",sep=""))
#or
as.expression(parse(text =paste("save(cart_", args, ", file=file)",sep="") ))
expression(save(cart_Kyphosis, file=file))
attr(,"srcfile")
<text>
attr(,"wholeSrcref")
save(cart_Kyphosis, file=file)
#nothing works. Any thoughts?
#even this works but not the save
png(filename=paste("cart_",args,".png" sep ="") , height = 500, width = 500,
bg = "white")
plot(get(paste("cart_",args, sep ="")))
dev...
2011 Apr 08
0
dynamic argument names and values as variables inside a loop
...tpm)
}
#Intuitively, the following should work (but does not):
my.func<-function(dat,varb){
dat.col<-dat[,varb]
vval<-unique(dat.col)
for(i in 1:length(vval){
args<-attr(parse(text=paste(varb,"=","\"",vval[i],"\"",sep="")),"wholeSrcref")
outpm<-a.func(eval(args))
}
return(outpm)
}
Any help is much appreciated, and I thank you for your time.
Here is a link to a similar problem that another useR recently posted:
https://stat.ethz.ch/pipermail/r-help/2011-January/264719.html
Best,
Christopher Marcum
Doctoral Candidate...
2013 Jun 24
0
sys.source() does not provide the parsing info to eval()
...39; atomic [1:8] 1 6 1 8 6 8 1 1
# .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'
<environment: 0x7f42951f3b00>
# - attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment:
0x7f42951f3b00>
# - attr(*, "wholeSrcref")=Class 'srcref' atomic [1:8] 1 0 2 0 0 0 1 2
# .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile'
<environment: 0x7f42951f3b00>
# NULL
print( str(ex[[1]]))
# language 1 + 1
# NULL
print( str(ex[1]))
# length 1 expression(1 + 1)
# - attr(*...
2023 Feb 05
1
R2HTML doesn't split paragraphs originating from \Sexpr[results=rd]
Hello,
Here's an example that renders correctly using Rd2txt / Rd2latex / R
CMD Rd2pdf, but has problems under Rd2HTML:
\name{foo}
\title{foo}
\section{foo}{
This should be on a separate paragraph
This should be on a separate paragraph
This should be on a separate paragraph
\Sexpr[stage=render,results=rd]{
paste(
rep('Sexpr: This should be on a separate
2011 Apr 13
0
R 2.13.0 is released
...uring the creation of the device window to prevent crashes. It
also imposes a limit of 144 ft^2 on the area used by a window to
catch user errors (unit misinterpretation) early.
? The browser (invoked by debug(), browser() or otherwise) would
display attributes such as "wholeSrcref" that were intended for
internal use only.
? R's internal filename completion now properly handles filenames
with spaces in them even when the readline library is used. This
resolves PR#14452 provided the internal filename completion is
used (e.g., by setting...
2011 Apr 13
0
R 2.13.0 is released
...uring the creation of the device window to prevent crashes. It
also imposes a limit of 144 ft^2 on the area used by a window to
catch user errors (unit misinterpretation) early.
? The browser (invoked by debug(), browser() or otherwise) would
display attributes such as "wholeSrcref" that were intended for
internal use only.
? R's internal filename completion now properly handles filenames
with spaces in them even when the readline library is used. This
resolves PR#14452 provided the internal filename completion is
used (e.g., by setting...