« first day (445 days earlier)      last day (2730 days later) » 

4:11 AM
BEST. HELP. DESCRIPTION. EVER.
Look at the help for changed.funs in mvbutils:
> Useful eg when you have been modifying a package, and have buggered stuff up, and want to partly go back to an earlier version. . . entirely hypothetical of course, things like that never ever happens to me. Mere mortals might want to create a new environment goodenv, use evalq(source(<<old.mypack.R.source.file>> local=T), goodenv), then find.changes( goodenv, asNamespace("mypack")).
> If your package is lazy-loaded, you’re stuffed; I avoid lazy-loading, except perhaps for final distribution, because it just makes it much harder to track problems. Not that I ever have problems, of course."
He says what I'm thinking.
 
4:46 AM
Mmmm, I'm just loving foodweb() in mvbutils, which mathematical.coffee suggested for my earlier question.
 
5:04 AM
HALLELUJAH. I think we have a winner.
@Andrie mvbutils::foodweb seems to do all kinds of stuff. If it doesn't give me a complete answer, it is still one freaking amazing improvement over my hack.
 
5:16 AM
Can someone explain Hadley's comment in this question? I think the holidays have nuked my understanding of this...
1
Q: Get Object methods R

C. ReedGiven an arbitrary R object, how can I obtain all the methods associated with the object? My apologies if this is answered somewhere else, but I can't seem to find it,

Never mind... I think that @DWin's answer does a fine job. I think that Hadley may have been excessively terse.
 
 
6 hours later…
10:53 AM
www.google.com -> define: terse -> aha!
@Iterator Googling "find methods r" shows up two top links - one explaining how to get methods for S4 and the other one for S3. :)
 
 
1 hour later…
12:05 PM
@Iterator That one's nice.
 
 
1 hour later…
1:23 PM
@RomanLuštrik Yeah, I got a lot of joy out of it last night.
 
1:41 PM
Mark Bravington is kind of out there
super smart statistician
he is very cynical about changes to R, but I think because he has his own workflow branch of things so he has to do a lot to stay compatible
 
 
1 hour later…
2:55 PM
Happy new year, fellow R geeks
 
 
2 hours later…
5:21 PM
It seems like I am re-learning R all over again.
 
5:31 PM
If I have a function in the global environment, i.e. not in a package, say myFunc and define a function inside of it, say localFunc, how do I refer to the environment or search path that will find localFunc? This has just slipped right out of my head.
 
5:55 PM
i think you need to 'get' it from the environment of the outer function...
except of course you cant
do you mean something like this: foo=function(x){bar=function(y){y+x};bar(x)}
 
sys.frames and the like are a source of madness...
something like that, yes.
 
well no, you cant get bar there, becuase its created and deleted when foo is called
 
Hmm, here is my example code:
>
myFunc <- function(x){
require(data.table)
require(mvbutils)
localFunc <- function(x){
return(as.data.table(x))
}

vecPrune <- c("localFunc",ls("package:data.table"))
ix <- grep("data.table",search())
tmpWeb <- foodweb(where = c(1,ix), prune = vecPrune, plotting = FALSE)
return(tmpWeb)
}
 
what is the 'prune' argument to foodweb supposed to be?
 
The opposite of what you'd expect. It's the list of things to keep track of, rather than the ones to omit.
 
6:00 PM
and you are passing it the name of a function?
 
Or at least the opposite of what I'd expect.
Yes, I added "localFunc" to the arguments (i.e. vecPrune), but that doesn't seem to work.
It isn't picking up localFunc.
When I use debug(), can't seem to find localFunc in the search path...
 
what does foodweb do?
 
It shows up for ls(), naturally...
foodweb is quite clever. It shows dependencies between functions.
 
pacakge?
 
Check out this page:
It's part of mvbutils.
It was brought to my attention in a comment to this question:
5
Q: Mapping R code to dependencies

IteratorI am sifting through a package and scripts that utilize the package, and would like to identify external dependencies. The goal is to modify scripts to specify library(pkgName) and to modify functions in the package to use require(pkgName), so that these dependencies will be more obvious later. ...

 
6:07 PM
how's this:
f=function(){z=function(){y(0)};y=function(z){z*2};p=foodweb(where=environment()‌​);return(p)}
> p=f()
> p
$funmat
SLAVE
MASTER y z
y 0 1
z 1 0
 
Hmm, that looks promising.
I am getting tied in knots on environments inside of functions.
Thanks!
 
you were trying to use '1' to get the current env?
 
<whistling....>
<...how to distract Spacedman....?>
 
I think I learned from @JDLong - sensei.
I think that was the problem.
(I mean the use of 1 for the current environment)
You have solved my problem.
I think this needs to be posted to SO. But without this mvbutils stuff. Somehow I was unable to find a way to refer to the current environment inside of a function.
 
6:13 PM
I suspect its using 1 as 1 in the search list, not 1 in the level of environments
yes
 
You're correct - using environment() solves all of the issues.
I am writing some little example functions for myself. This is one that I couldn't nail down.
Thanks again.
How about if I post a question along these lines & you answer it?
 
mmmmaybe. food time now. maybe later!
 
Aargh
Here's the link:
0
Q: How can I reference the environment for searching within a function?

Iterator[This question has been resolved in the chat room, but I'm posting it for others' benefit in the future.] I have a function, myFunc, which creates localFunc inside of it. (NB: this is not in a package, but in the global environment.) I'd like to know where localFunc exists in the search path, ...

Feel free to answer when you have time.
Feel free to fix the question, if I've used the wrong lingo... :)
 

« first day (445 days earlier)      last day (2730 days later) »