Skip to content
Back to formatted view

Raw Message

Message-ID: <ca4ddb3d-110d-fe3f-240c-b8ba0217a146@sapo.pt>
Date: 2021-09-02T11:31:17Z
From: Rui Barradas
Subject: Show only header of str() function
In-Reply-To: <CAMk+s2Q9QxN9fNdCEyEgjXw4Gvn72K4C=3N2r7cm7Q94g7XX2w@mail.gmail.com>

Hello,

Not perfect but works for data.frames:


header_str <- function(x){
   capture.output(str(x))[[1]]
}
header_str(iris)
header_str(AirPassengers)
header_str(1:10)


Hope this helps,

Rui Barradas

?s 12:02 de 02/09/21, Luigi Marongiu escreveu:
> Hello, is it possible to show only the header (that is: `'data.frame':
> x obs. of  y variables:` part) of the str function?
> Thank you
>