[R] function doesn't exists but still runs.....

akshay kulkarni @k@h@y_e4 @end|ng |rom hotm@||@com
Fri Jan 20 18:07:49 CET 2023


Dear Greg,
                  THanks for a very well pointed answer.....

THanking you,
yours sincerely
AKSHAY M KULKARNI
________________________________
From: Greg Snow <538280 using gmail.com>
Sent: Friday, January 20, 2023 10:28 PM
To: akshay kulkarni <akshay_e4 using hotmail.com>
Cc: R help Mailing list <r-help using r-project.org>
Subject: Re: [R] function doesn't exists but still runs.....

A little simpler answer than the others.

Look at package Namespaces.  When a package is created, the NAMESPACE
file defines which functions in the package are exported (i.e.
available for you to use), the other functions are "private" to the
package meaning that other functions in the package can call those
functions, but they are not meant to be called directly by the user.

So in your case, the `selenium` function was exported, but
`java_check` was not exported.  The function does exist, but R's
regular search rules do not find it when you try to call it directly
(but because it shares the Namespace with selenium, it is found when
called there).

It is possible to call non-exported functions (use something like
RSelenium:::java_check()), but non-exported functions are not usually
documented and subject to change without any warning.  You are using
the functionality in a way different from how the author intended, so
there are no guarantees that it will do what you think it should.

On Thu, Jan 19, 2023 at 3:28 PM akshay kulkarni <akshay_e4 using hotmail.com> wrote:
>
> dear members,
>                             I am using the RSelenium package which uses the function selenium() from the wdman package. The selenium function contains the function java_check at line 12. If I try to run it, it throws an error:
>
> >   javapath <- java_check()
> Error in java_check() : could not find function "java_check"
>
> Also:
>
> > exists("java_check")
> [1] FALSE
>
> But when I run selenium(), it works fine....
>
> How do you explain this conundrum? You can refer to this link: https://github.com/ropensci/wdman/issues/15
>
> Specifically what concept of R explains this weird behaviour?
>
> Thanking you,
> Yours sincerely,
> AKSHAY M KULKARNI
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



--
Gregory (Greg) L. Snow Ph.D.
538280 using gmail.com

	[[alternative HTML version deleted]]



More information about the R-help mailing list