0

In R, how do I look at the code for the data.frame method of the [ function?

I have tried the usual plain return on [.data.frame, [.data.frame, and [.data.frame, and none of them work, nor do any of them work with getAnywhere(). getMethod("[", "data.frame") didn't work either. <- the code designations in this paragraph actually denote being surrounded by backticks.

I'm actually looking for the standard code that lets you refer to columns by name, vector of position numbers, logical vector or negative number. If someone could point me toward such code in a more accessible location, that would also constitute a solution from my point of view.

andrewH
  • 2,281
  • 2
  • 22
  • 32
  • Try `\`[.data.frame\` ` – G5W Sep 24 '17 at 18:17
  • You were almost there. `getAnywhere(\`[.data.frame\`)`. Surrounded by backticks, the formating of comments doesn't allow them to be seen. (Yes it does, just escape them.) – Rui Barradas Sep 24 '17 at 18:19
  • or [here](https://github.com/wch/r-source/blob/trunk/src/library/base/R/dataframe.R#L551) – Ben Bolker Sep 24 '17 at 18:26
  • G5W, I would have sworn on a stack of bibles that I had tried exactly that. I guess I had a typo. – andrewH Sep 24 '17 at 20:00
  • Rui Barradas, thanks, that works too. – andrewH Sep 24 '17 at 20:01
  • G5W and Rui, If either of you would care to make your comment an answer, I'd accept it. – andrewH Sep 24 '17 at 20:02
  • Ben Bolker, I went through this searching on "#". The comments, generally brief though they are, were surprisingly helpful in understanding the code. Is there a more generalized way of finding the code with comments included? I'd accept that as an answer too. – andrewH Sep 24 '17 at 20:17

0 Answers0