Skip to content

Works outside but not inside!

2 messages · Keith S Weintraub, Sarah Goslee

#
Folks,
The following function works like a charm!
But when I run the function inside some other code:
I have the following packages loaded:
require(XLConnect)
require(plyr)
require(sm)
require(fOptions)
require(fCopulae)

I have spent a lot of time on this to no avail.

Any help would be appreciated.

Best,
KW
#
Well, what happens? "Doesn't work" covers a lot of ground, and you don't
provide a reproducible example.

Also, why all the > at the beginning PDF lines? Your R prompts shouldn't
look like that when entering a function, and they make it impossible to
just cut and paste the code. Not that we have any data to try it on,
either.

However, I'm going to take a wild guess that you meant to call the argument
to the first function am rather than ams because you use an object named
the former in the function, ands  not the latter. I'm further going to
guess that you have an object named am in your workspace, so the function
is running from the console because it is silently using that object. But
from another function it can't find it.

So, your first function is not actually correct, and starting from a clean
session would have shown you that, as would the process of making a
reproducible example.

Sarah
On Wed, Feb 15, 2017 at 7:51 AM Keith S Weintraub <kw1958 at gmail.com> wrote: