number of observations in str method, using vec.len

hello everyone, i would request all experts in R to help me.
In str function, there's an argument vec.len, here's a screenshot from documentation


It says this
The number is multiplied by different factors (from .5 to 3) depending on the kind of vector.
I am unable to understand the working and with which factor does it multiply with for which vector?
Pls cite the reference also
Thanks in advance:)

i used str method on mtcars data frame. here is the result, but all variables have 10 observations except for disp, which has 5 observations, why?

also cite the reference if you have any

... at the end of each line indicates more values.

Confirm

check_lengths <- function(x) length(mtcars[,x]) == length(mtcars$disp)
the_vars <- colnames(mtcars)
results <- list()
for(i in seq_along(the_vars)) results[i] = check_lengths(i)
unlist(results)
#>  [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE

Is this the source code for compiler for R?

R is an interpreted language, like Python, not a complied language like C, Rust or Haskell, say. The source code doesn’t get compiled into binary. Every script is readable exactly the same way as the interpreter gets it to run through the terminal or the RStudio IDE. So, if you cut and paste the snippet, you should get the same results.

This topic was automatically closed 21 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.