The paste FunctionMegan KressOctober 18, 2016
paste {base}The paste function takes in R objects as arguments. It converts those objects to character vectors (strings) and concatenates them together. By default, a space character separates the two terms. See the CRAN page for more information.
Example 1This example shows a simple pasting of a string object and numeric object.
Example 2This example shows how you can use paste to customize strings in plot labels (in this case, the title of each plot). The data set used is the built-in chickwts data frame, which has columns “weight” and “feed.” The code produces histograms of weight at different feed treatments.
Thus, paste allows us to create correctly-labeled and descriptive plots.
0 Comments
Leave a Reply. |
Spatial Ecology @ MSUClick on "Category" below to search for R code compiled by the Zarnetske Spatial & Community Ecology Lab and students in MSU's Spatial Ecology graduate course (FOR870/FW870) Category
All
Archive
October 2016
|