class types different between excuted code in quarto and console

HI All

I like to use quarto as it is easier to write documentation.
However i have a problem
i created a tibble from an xlsx file
Screenshot_book1

Load Libraries

{r}

library("tidyverse")
library("lubridate")
library("tsibble")
library("tsibbledata")
library("feasts")
library("fable")
library("readxl")

Create tibble from an excel file:

{r}

tibble_example <- read_xlsx("data/Book1.xlsx")
{r}

tibble_example %>% print()

excuting code in quarto


excuting code in console
tibble_console

im getting a bit confused between the differnt class types

question 1
is there a way to print in quarto getting the same class types that i got in the console? i understand better dttm, but don´t understand <S3: POSIXct>
question 2
is it possible to run the code in quarto window but print only in the console? (so i can get dttm)
is it possible to run the code in quarto window but print both in quarto and the console?

My target is to create tsibbles from tibbles but I´m getting confused with the class types printed in quarto

thanks in advance

Tony

It's actually the same class: POSIXct. dttm is not a real class, just a nice way of displaying it. You can check that with class(tibble_example$Month) which returns in every context: [1] "POSIXct" "POSIXt".

This looks like a bug in RStudio's visual editor: in the console or a rendered document, the column type is displayed as dttm, but in the visual editor, it is displayed as S3: POSIXct.

This is not unique to Quarto, the same display bug happens for an Rmarkdown document.

This can be shown with an even more minimal example:

{r}
tibble::tibble(a = Sys.time())
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.