Message-ID: <CAGxFJbR4RGDjja7L3gv7pj3rk2hR_bzNpmfHvT+BBGiXFG8n3w@mail.gmail.com>
Date: 2022-03-23T19:47:00Z
From: Bert Gunter
Subject: print only a few lines of an object
In-Reply-To: <46EC3719-2BDF-4B72-A0BF-145ADE8CA5C1@dcn.davis.ca.us>
Well, that depends whether the object has/inherits from a class for
which there is a suitable method for head/tail and for printing the
result. So I think your before-thought applies :-)
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Wed, Mar 23, 2022 at 12:42 PM Jeff Newmiller
<jdnewmil at dcn.davis.ca.us> wrote:
>
> After-thought...
>
> Why not just use head() and tail() like normal R users do?
>
> On March 23, 2022 12:31:46 PM PDT, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:
> >Sure. Re-define the print method for those objects. Can't say I recommend this, but it can be done.
> >
> >On March 23, 2022 11:44:01 AM PDT, Naresh Gurbuxani <naresh_gurbuxani at hotmail.com> wrote:
> >>In an R session, when I type the name of an object, R prints the entire object (for example, a 20000 x 5 data.frame). Is it possible to change the default behavior so that only the first five and last five rows are printed?
> >>
> >>Similarly, if the object is a 20000 x 200 matrix, the default behavior will be to print first five and last five columns, combined with first five and last five rows.
> >>
> >>Thanks,
> >>Naresh
> >>______________________________________________
> >>R-help at 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.
> >
>
> --
> Sent from my phone. Please excuse my brevity.
>
> ______________________________________________
> R-help at 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.