concept element in category R

This is an excerpt from Manning's book Exploring Data with R.
Through most of the ggplot examples we’ve worked through up to this point, default text was applied to plot elements such as the axis labels and the legend titles. While this is certainly convenient and sufficient for most exploratory plots, we may want to customize the text elements for the purpose of presentation and more effective communication.
Listing 8.5 How combining elements of different types results in coercion.
```{r coercion_to_character} c(7, 1.2, TRUE, 6.4/2, FALSE, "hello") ```
A list object in R is kind of like a container that can hold any type of R object, even other lists. The components of the list can have names, they can be unnamed (relying on numerical indices to distinguish between the components), or, we can have a mixture of named and unnamed components. They can be as simple as a vector, or, have numerous nested components. A good enough analogy for an R list is a computer’s file system, where directories might hold elements (including more directories) and files are the addressable elements themselves. A well-structured list is valuable as a complex data structure. Given that a function can only return a single object, and that a function may create complex data, a list adorned with different types of information can be returned and further used by other functions that require a little or a lot of that information.

This is an excerpt from Manning's book Beyond Spreadsheets with R.
Fortunately, elements of vectors in R can have individual names associated with them, so you can recall which value represents which thing. Specify these as argument names to
c(), which will create a vector from all of its arguments:c(apple = 5030, banana = 4011, pear = 4421) #> apple banana pear #> 5030 4011 4421Notice now that the line has no
[1]prefix, and that the names of the elements are listed above their values. R does an okay job of making sure that these stay aligned, even if their values are longer than their names:
The
matrix()function will populate this matrix one column at a time by default. If the data is arranged such that it needs to be entered one row at a time, there is an optional argumentbyrow. Note that because the input is a vector (created usingc()here), the elements must all be of the same type. This is a restriction on thematrixobject.