search for: srcfilecopi

Displaying 20 results from an estimated 25 matches for "srcfilecopi".

Did you mean: srcfilecopy
2013 Jun 24
0
sys.source() does not provide the parsing info to eval()
Hello, It seems that the parsing information attached to expressions parsed by the parse() function when keep.source=TRUE is not provided to the eval() function. Please consider this code: path <- tempfile() code <- '(function() print( str( sys.calls() ) ))()' writeLines(code, path) sys.source(path, envir=globalenv(), keep.source=TRUE) > OUTPUT: Dotted pair list of 4 $ :
2012 May 25
4
Problem sourcing file
Hi all, I created a file to define some functions. When I try to source this file, sometimes it works but sometimes I get the following error: >Source(‘File.R’) Error in srcfilecopy(filename, lines, file.info(filename)[1, "mtime"]) : unused argument(s) (file.info(filename)[1, "mtime"]) It works when I just started the R session, but after using some
2016 Mar 13
1
formals(x)<- drops attributes including class
Just checking in to see whether it is intended or not that assigning new formals to a function/closure causes any attributes to be dropped: EXAMPLE: > fcn <- structure(function() {}, foo="foo", class=c("foo")) > str(fcn) function () - attr(*, "srcref")=Class 'srcref' atomic [1:8] 1 18 1 30 18 30 1 1 .. ..- attr(*, "srcfile")=Classes
2013 Dec 13
1
Proper way to drop 'srcref' from an expression created via substitute(function() ...)?
First, why does this expression have a 'srcref' element: > exprA <- substitute(function(x) a*x, list(a=2)) > print(exprA) function(x) 2 * x > str(as.list(exprA)) List of 4 $ : symbol function $ :Dotted pair list of 1 ..$ x: symbol $ : language 2 * x $ :Class 'srcref' atomic [1:8] 1 20 1 34 20 34 1 1 .. ..- attr(*, "srcfile")=Classes
2023 Mar 30
1
removeSource() vs. function literals
Dear R-devel, In a package of mine, I use removeSource on expression objects in order to make expressions that are semantically the same serialize to the same byte sequences: https://github.com/cran/depcache/blob/854d68a/R/fixup.R#L8-L34 Today I learned that expressions containing function definitions also contain the source references for the functions, not as an attribute, but as a separate
2012 Jan 11
1
parse( connection) and source-keeping
In R <= 2.13.x, calling 'parse( con)' where 'con' is a connection, 'options( keep.source)' is TRUE, and default 'srcfile' would preserve the source. In R >= 2.14.1, it doesn't. > tf <- tempfile() > options( keep.source=TRUE) > texto <- c( 'function() { # comment', '}') > parse( text=texto) expression(function() { #
2017 Aug 28
3
[bug report] Cyrillic letter "я" interrupts script execution via R source function
Hello, I do not have an account on R Bugzilla, so I will post my bug report here. I want to report a very old bug in base R *source()* function. It relates to sourcing some R scripts in UTF-8 encoding on Windows machines. For some reason if the UTF-8 script is containing cyrillic letter *"?"*, the script execution is interrupted directly on this letter (btw the same scripts are sourcing
2023 Mar 31
2
removeSource() vs. function literals
If you can afford a dependency on rlang, `rlang::zap_srcref()` deals with this. It's recursive over expression vectors, calls (including calls to `function` and their hidden srcref arg), and function objects. It's implemented in C for efficiency as we found it to be a bottleneck in some applications (IIRC caching). I'd be happy to upstream this in base if R core is interested. Best,
2023 Mar 30
2
removeSource() vs. function literals
On 30/03/2023 10:32 a.m., Ivan Krylov wrote: > Dear R-devel, > > In a package of mine, I use removeSource on expression objects in order > to make expressions that are semantically the same serialize to the > same byte sequences: > https://github.com/cran/depcache/blob/854d68a/R/fixup.R#L8-L34 > > Today I learned that expressions containing function definitions also >
2016 Oct 12
2
How to assign NULL value to pairlist element while keeping it a pairlist?
Thanks, this was what I expected. There is a desire to eliminate the usage of pairlist from user code, which suggests the alternative of allowing for function arguments to be stored in lists. That's a much deeper change though. On Wed, Oct 12, 2016 at 12:31 PM, Henrik Bengtsson <henrik.bengtsson at gmail.com> wrote: > Michael, thanks for this info. > > I've stumbled upon
2016 Oct 12
2
How to assign NULL value to pairlist element while keeping it a pairlist?
Hi Henrik, It would help to understand your use case for pairlists. Thanks, Michael On Wed, Oct 12, 2016 at 9:40 AM, Michael Lawrence <michafla at gene.com> wrote: > The coercion is probably the most viable workaround for now, as it's > consistent with what happens internally for calls. All pairlists/calls > are converted to list for subassignment, but only calls are
2016 Oct 19
2
How to assign NULL value to pairlist element while keeping it a pairlist?
On Sat, Oct 15, 2016 at 2:00 AM, Martin Maechler <maechler at stat.math.ethz.ch> wrote: >>>>>> Michael Lawrence <lawrence.michael at gene.com> >>>>>> on Wed, 12 Oct 2016 15:21:13 -0700 writes: > > > Thanks, this was what I expected. There is a desire to > > eliminate the usage of pairlist from user code, which > >
2007 Jan 07
1
substitute creates an object whichprints incorrectly (PR#9427)
> I think we should get rid of source attributes completely, > since they are no longer needed, but your comment still > applies to source references. We should strip them when code > gets modified. > > Duncan Murdoch I would be very concerned about losing source attributes-- it would break a lot of my code :(! It's very useful to have a single portable R object that
2016 Oct 12
0
How to assign NULL value to pairlist element while keeping it a pairlist?
Michael, thanks for this info. I've stumbled upon this in a case where I walk an R expression (the AST) and (optionally) modifies it (part of the globals package). In R expressions, a function definition uses a pairlist to represent the arguments. For example, > expr <- quote(function(x = 1) x) > str(as.list(expr)) List of 4 $ : symbol function $ :Dotted pair list of 1 ..$ x:
2013 Oct 24
0
TR: problem with ecdf : "missing C_R_approxfun" message
Hi again, this is a follow-up of my previous post : I've noticed that > attr(first.list[[1]]$size.ecdf,"call") gives ecdf(test.moms[, "m.pxs"]) and that there is no "test.moms" field in my records (a local variable named test.moms was used inside a function, but it was stored under another name in the list, outside the function) May this be the answer (and
2017 Aug 28
0
[bug report] Cyrillic letter "я" interrupts script execution via R source function
My understanding (which could be wrong) is that when you source a file, it first gets translated to your native locale and then parsed. When you parse a character vector, it does not get translated. In your locale, every "?" character (U+044F) gets replaced by the byte "\xFF": > iconv("\u044f", "UTF-8", "Windows-1251") [1]
2016 Oct 15
0
How to assign NULL value to pairlist element while keeping it a pairlist?
>>>>> Michael Lawrence <lawrence.michael at gene.com> >>>>> on Wed, 12 Oct 2016 15:21:13 -0700 writes: > Thanks, this was what I expected. There is a desire to > eliminate the usage of pairlist from user code, which > suggests the alternative of allowing for function > arguments to be stored in lists. That's a much deeper
2016 Oct 19
0
How to assign NULL value to pairlist element while keeping it a pairlist?
On Wed, 19 Oct 2016, Henrik Bengtsson wrote: > On Sat, Oct 15, 2016 at 2:00 AM, Martin Maechler > <maechler at stat.math.ethz.ch> wrote: >>>>>>> Michael Lawrence <lawrence.michael at gene.com> >>>>>>> on Wed, 12 Oct 2016 15:21:13 -0700 writes: >> >> > Thanks, this was what I expected. There is a desire to >>
2011 Dec 22
0
R 2.14.1 is released
The byte pixies have rolled up R-2.14.1.tar.gz (codename "December Snowflakes") at 9:00 this morning. This is a maintenance release; see the list below for details. You can get it from http://cran.r-project.org/src/base/R-2/R-2.14.1.tar.gz or wait for it to be mirrored at a CRAN site nearer to you. Binaries for various platforms will appear in due course. For the R Core Team
2011 Dec 22
0
R 2.14.1 is released
The byte pixies have rolled up R-2.14.1.tar.gz (codename "December Snowflakes") at 9:00 this morning. This is a maintenance release; see the list below for details. You can get it from http://cran.r-project.org/src/base/R-2/R-2.14.1.tar.gz or wait for it to be mirrored at a CRAN site nearer to you. Binaries for various platforms will appear in due course. For the R Core Team