[R language] The difference between applying str and glimpse functions to tibble

tags: r language  Development language

Both the str function and glimpse can facilitate us to view the details of the variables in the data frame.However, there is a big difference between the display of the two when the data structure is a tibble containing a list

Take the built-in dataset starwars of the tidyverse library as an example,The variables flims, vehicles, and starships are all list, which is no longer a single value or character, when using the glimpse function to view the data set, it is displayed as:

You can see the bottom three lines, including the variables of the list, the summary is clearly displayed, and when using the str function on this data set:

(Here is a screenshot of the beginning and end of the console output)
Obviously, the str function not only expands the variables in the tibble, but also expands the contents of the list elements, which makes it inconvenient to view the data frame information in this format.

Therefore, when our processing object iscontains listWhen using tibble data, using the glimpse function can be more concise and clear.

Intelligent Recommendation

The difference between str built-in functions isdigit, isdecimal, isnumeric in python

Still can't understand the difference, keep it for future use. The result is: The result is: (only the first one can output normally, the other two report attributes are wrong)...

The difference between str and json.dumps

This article first appeared inKnow almost We use json files to store data, usually used before writing to a file.json.dumpsThe function converts the python object into a string and writes it to the fi...

The difference between str() and repr()

Despite str(), repr() andThe operations are very similar in terms of features and functions, in fact repr() andDoing exactly the same thing, they return an "official" string representation o...

The difference between list and str

string The output is Hello World! H llo llo World! Hello World!Hello World! Hello World!TEST List: can be a collection of multiple strings The output is [‘runoob’, 786, 2.23, ‘john&r...

More Recommendation

The difference between str and repr

When Python prints a value, it will maintain the state of the value in the Python code, not the state that the user wants to see. The value printed using print is different. The value printed by print...

The difference between sizeof and str

to sum up: sizeof is an operator, strlen is a library function; The parameter of sizeof can be a data type or a variable, and strlen can only use a character string ending in ‘\0’ as a par...

R for Data Science summarizes - tibble

The traditional data.frame in R is a very old data structure, and a new tibble is proposed in the new tidyverse framework to replace some old behavior patterns: Convert old data frames to tibble: Crea...

R manual (Common)--tidyverse+tibble

table of Contents tidyverse tibble tidyverse Usage small, in-memory data ( <2Gb): tidyverse larger data (10-100 Gb): data.table Parallel computing : need a system (like Hadoop or Spark) core tidyve...

The difference between the parameters of sklearn SVM and R language

Sklearn's SVM function does not scale the data, and the corresponding function of the e1071 package does the data. So you need to specify in the R languagescale=FALSEWill produce similar results to sk...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top