[R] Add column index number to str() output

Peter Ehlers ehlers at ucalgary.ca
Fri Nov 23 21:40:12 CET 2012


On 2012-11-23 08:54, seth.fore wrote:
> I often find it would be very useful when inspecting a data structure using str() to know the column index number in order to rearrange the data in a manner amenable to my purpose. Is there a way to modify the display options of the str() function to add column index? I know this is really a trivial matter but it would increase the utility of the str() function for me and increase the speed with which I can manipulate the data structure. Thanks,
>
> Seth

Presumably, you're talking about dataframes. I don't see this
as particularly useful unless you're in the habit of processing
your data by column _number_ rather than variable _name_.
If so, I would strongly discourage that habit.
And a cursory look at str.default() suggests that it may not be
all that trivial a code change.

Peter Ehlers




More information about the R-help mailing list