showkey
showkey

Reputation: 298

how can i display the function which has no asterisked at the end?

methods(print)
omitted many outputs
[175] print.vignette*  print.warnings   print.xgettext*                              
[178] print.xngettext*  print.xtabs*                                 

 Non-visible functions are asterisked

how can i get the function on print which has no asteriske at the end ? print.warnings should be displayed ,print.xtabs* should not be displayed.

 methods(print)->x
 x[grep("^//*",x)]
 x[grep("^*",x)]    

it is failure.

Upvotes: 1

Views: 43

Answers (1)

Ben Bolker
Ben Bolker

Reputation: 226662

The asterisks aren't really part of the string (so they won't be detected by applying grep to the strings, even if you get the regular expression incantation right), they're appended by the print.MethodsFunction method. Maybe this will do what you want:

methods(print)->x
vis <- attr(x,"info")[,"visible"]
x[!vis]
x[vis]

(I figured this out by looking at the output of str(x))

Upvotes: 2

Related Questions