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.
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)...
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...
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...
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...
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...
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...
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...
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...
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...