You can select columns from a data.frame
in R by using indexing or subsetting. Here are some examples:
main.r15 chars2 lines
main.r19 chars2 lines
main.r20 chars2 lines
main.r41 chars2 lines
Example:
main.r302 chars9 lines
In this example, we created a data frame with columns "name", "age", "salary", and "gender". We then used column names "age" and "gender" to create a new data frame age_gender
that contains only these two columns.
gistlibby LogSnag