similar to: Evaluating Assignment-Operator R 2.0.0

Displaying 20 results from an estimated 5000 matches similar to: "Evaluating Assignment-Operator R 2.0.0"

2023 Mar 19
1
WISH: Optional mechanism preventing var <<- value from assigning non-existing variable
I think that should be the default behaviour. It's pretty late to get that into R 4.3.0, but I think your proposal (with check.superassignment = FALSE being the default) could make it in, and 4.4.0 could change the default to TRUE. Duncan On 19/03/2023 12:08 p.m., Henrik Bengtsson wrote: > I'd like to be able to prevent the <<- assignment operator ("super >
2023 Mar 19
1
WISH: Optional mechanism preventing var <<- value from assigning non-existing variable
I'd like to be able to prevent the <<- assignment operator ("super assignment") from assigning to the global environment unless the variable already exists and is not locked. If it does not exist or is locked, I'd like an error to be produced. This would allow me to evaluate expressions with this temporarily set to protect against mistakes. For example, I'd like to
2023 Mar 19
2
WISH: Optional mechanism preventing var <<- value from assigning non-existing variable
Why should it make an exception for cases where the about-to-be-assigned-to name is present in the global environment? I think it should warn or give an error if the altered variable is in any environment on the search list. -Bill On Sun, Mar 19, 2023 at 10:54?AM Duncan Murdoch <murdoch.duncan at gmail.com> wrote: > I think that should be the default behaviour. It's pretty late to
2023 Mar 19
1
WISH: Optional mechanism preventing var <<- value from assigning non-existing variable
I have to say <<- is a core debugging tool when assigning into the global environment. I suppose I could use assign but that would be somewhat annoying. That said I'm still for this change, the vast overwhelming number of times that <<- is in my package code - already rare but it does happen - it would absolutely be a bug (typo most likely) for it to get to the global environment
2009 Jun 03
3
Return variable assignments from a function
I'd like to perform return variable assignments like matlab. For example, the following function would return A, B, and c to the script that called it. ================================= function [A,B,c] = simple(m,n) A=[ 3 2; 3 3] B=m c=1:n ================================= I'd like to do similar assignments in R, but I seem to be able to only return one variable. I tried to use a
2016 Apr 12
3
formula argument evaluation
I have a simple function such as: foo <- function(x) { call <- lapply(match.call(), deparse) testit <- capture.output(tryCatch(eval(x), error = function(e) e)) if (grepl("Error", testit)) { return(call$x) } } and I would like to detect a formula when x is not an object: # this works > foo(A + B) [1] "A + B" # but this doesn't >
2011 Apr 21
6
What does the "<<-" operator mean?
I've been reading some code from an example in a blog post ( http://www.maxdama.com/ here ) and I came across an operator that I hadn't seen before. The author used a <<- operator to update a variable, like so: ecov_xy <<- ecov_xy+decay*(x[t]*y[t]-ecov_xy) At first I thought it was a mistake and tried replacing it with the usual <- assignment operator, but I didn't
2008 Sep 02
2
How is the binding for a super assignment made visible?
The statement Globals <<- list() in the body of a function in a package was intended to write an empty list to the R workspace to collect results during the computations of the function. A package name space has not been specified. The package appears to function correctly, but during the R CMD check of the package while "checking R code for possible problems ... NOTE", no
2019 Jun 21
3
Samba winbind on centos 7 - "domain users" acls added
hello, My 2nd issue is about acls which are added by "Domain users". May you help me to solve it again ? Concerning this issue, on my samba share, I set permissions for the share "groups" located on /var/datashared for "domain admins" (rwx) and "domain users" (r-x) /var]# getfacl datashared/ # file: datashared/ # owner: root # group: root user::rwx
2002 Aug 06
2
[ and setMethod conflict?
I noticed this oddity about [ and setMethod. First, I define testFunc, which sorts a data frame by the first column and returns the entries that aren't NAs, and testIt, which runs testFunc repeatedly on a random large data frame, each time saving the return into a dummy placeholder (for demonstration's sake). > require(methods) Loading required package: methods [1] TRUE > testFunc
2002 Aug 06
2
[ and setMethod conflict?
I noticed this oddity about [ and setMethod. First, I define testFunc, which sorts a data frame by the first column and returns the entries that aren't NAs, and testIt, which runs testFunc repeatedly on a random large data frame, each time saving the return into a dummy placeholder (for demonstration's sake). > require(methods) Loading required package: methods [1] TRUE > testFunc
2011 May 05
2
Compiling a FORTRAN program under Windows 7
Hi, I am trying to compile a FORTRAN program to call from R under Windows 7 but I am having problem in the compiling step. To demonstrate this is the program testit.f: ------------------------------------------ subroutine TESTIT(x,n,m) dimension x(n) do 10 i=1,n 10 x(i)=x(i)**m end -------------------------------------------- When I compile it with gfortran I get
2018 Feb 15
3
using cat to log to file with sapply
Hi List, I am trying to write unsuccessfully to a logfile with cat. Here my example code: letters[1:5]->x logf<-"test.txt" cat('%%%%%%%%%%%%%%%%%%%%%%%%%%\n',file=logf) catf<-function(x,...,logfile='log.txt', append=TRUE){ cat(x,'\n', file=logfile, append=append)} testit<-function(x,...){ paste0('this is x: ',x)->y return(y)
2009 Jul 02
3
Question about <<- assignment
Is this expected behavior? > z <- 1:5 > z[1] <<- 0 Error in z[1] <<- 0 : object "z" not found The documentation seems to suggest that z will be found in the global environment and modified accordingly. Best, Hsiu-Khuern.
2001 May 09
1
Fortran subroutines dblepr, realpr, intpr
I am making my first attempts at using some Fortran code with R, and so far it's going OK. To print from my Fortran programs, it seems I need subroutines dblepr, realpr and intpr. From the excellent "Writing R Extensions" document: "Three subroutines are provided to ease the output of information from FORTRAN code. subroutine dblepr(label, nchar, data, ndata)
2019 Jun 20
2
Samba winbind on redhat 7
This way is so easier... Thank you Rowland Le 20/06/2019 ? 14:01, Rowland penny via samba a ?crit?: > On 20/06/2019 17:54, Edouard Guign? via samba wrote: >> My idea is to replace default "cifs_idmap_sss.so" plugin by >> "idmapwb.so" winbind plugin, in order to SSSD becomes a client of >> winbind. >> To avoid to change nsswitch.conf : >>
2019 Nov 08
3
improving the performance of install.packages
Hello, Currently if you install a package twice: install.packages("testit") install.packages("testit") R will build the package from source (depending on what OS you're using) twice by default. This becomes especially burdensome when people are using big packages (i.e. lots of depends) and someone has a script with: install.packages("tidyverse") ... ... later
2011 Apr 09
2
A question about "txtProgressBar" function
Hi, I tried to add a progress bar to my script, but it seems the "txtProgressBar" function will wipe out what I want to print before it(for example - the "Hello" in following script), and the parameters "title" and "label" do not work either. How can I put a title for the progress bar? or is there any other better function I can use? testit <-
2000 Jun 08
3
Output args?
Hi, Is there a way to find out if a function was called with an output argument? Or to prevent the printing of large amount of data if the function was called without output argument? Thanks YG -------------- next part -------------- An HTML attachment was scrubbed... URL: https://stat.ethz.ch/pipermail/r-help/attachments/20000608/8d7a01ec/attachment.html
2008 Feb 28
0
use of step.gam (from package 'gam') and superassignment inside functions
Hello, I am using the function step.gam() from the 'gam' package (header info from library(help=gam) included below) and have come across some behavior that I cannot understand. In short, I have written a function that 1) creates a dataframe, 2) calls gam() to create a gam object, then 3) calls step.gam() to run stepwise selection on the output from gam(). When I do this, gam()