Re: [R] Inserting missing seq number

2022-03-30 Thread Jeff Reichman
Bill Thank you. This is a third option to look into. Jeff From: Bill Dunlap Sent: Wednesday, March 30, 2022 10:40 AM To: reichm...@sbcglobal.net Cc: R-help@r-project.org Subject: Re: [R] Inserting missing seq number stats::approx can do the job: > approx(x=df$seq, df$count,

Re: [R] Creating and manipulating environment within function

2022-03-30 Thread Rui Barradas
Hello, Use ?assign instead. And there was a bug in manipulate_e1, it would throw an error a not found. create_e1 <- function(){ assign("e1", new.env(), envir = globalenv()) exists('e1', mode = 'environment') } manipulate_e1 <- function(a){ if ( exists('e1', mode = 'environment') ) {

Re: [R] Inserting missing seq number

2022-03-30 Thread Bill Dunlap
stats::approx can do the job: > approx(x=df$seq, df$count, xout=1:7, method="constant", f=0) $x [1] 1 2 3 4 5 6 7 $y [1] 4 7 7 3 5 5 2 -Bill On Tue, Mar 29, 2022 at 7:47 PM Jeff Reichman wrote: > R-help > > Is there a R function that will insert missing sequence number(s) and then > fill a

Re: [R] Where is list.names?

2022-03-30 Thread Ivan Krylov
В Wed, 30 Mar 2022 12:43:52 +0200 Göran Broström пишет: > That works, if I check for missing argument > Is this the final word? How about omitting it entirely and letting ... handle it? table <- function( ..., useNA = "ifany", exclude = if (useNA == "no") c(NA, NaN), deparse.level = 1 )

Re: [R] Where is list.names?

2022-03-30 Thread Eric Berger
At the R console prompt do: > table It prints out the source of the table() function. The first thing there is the definition of list.names() HTH, Eric On Wed, Mar 30, 2022 at 12:27 PM Göran Broström wrote: > I am trying to redefine the default behavior of base::table by editing >

Re: [R] Where is list.names?

2022-03-30 Thread Ivan Krylov
В Wed, 30 Mar 2022 11:27:05 +0200 Göran Broström пишет: > I can guess what 'list.names' is (from the documentation), but where > and how is it defined? Interesting! It's defined first thing inside the function, so by the time the function tries to use the argument, list.names exists and can be