[R] Show only header of str() function

Luigi Marongiu m@rong|u@|u|g| @end|ng |rom gm@||@com
Thu Sep 2 14:47:21 CEST 2021


Thank you! better than dim() anyway.
Best regards
Luigi

On Thu, Sep 2, 2021 at 1:31 PM Rui Barradas <ruipbarradas using sapo.pt> wrote:
>
> 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
> >



-- 
Best regards,
Luigi



More information about the R-help mailing list