Difference between revisions of "RPR-OBJECTS-Lists"
m |
m |
||
Line 40: | Line 40: | ||
<!-- included from "ABC-unit_components.wtxt", section: "notes-prerequisites" --> | <!-- included from "ABC-unit_components.wtxt", section: "notes-prerequisites" --> | ||
You need to complete the following units before beginning this one: | You need to complete the following units before beginning this one: | ||
− | *[[RPR-Objects- | + | *[[RPR-Objects-Data_frames]] |
{{Vspace}} | {{Vspace}} |
Revision as of 23:40, 10 September 2017
R "Lists"
Keywords: Lists
Contents
Abstract
...
This unit ...
Prerequisites
You need to complete the following units before beginning this one:
Objectives
This unit will ...
- ... introduce ;
- ... discuss ;
- ... teach ;
Outcomes
After working through this unit you ...
- ... have done;
- ... know how ;
- ... can ;
Deliverables
- Time management: Before you begin, estimate how long it will take you to complete this unit. Then, record in your course journal: the number of hours you estimated, the number of hours you worked on the unit, and the amount of time that passed between start and completion of this unit.
- Journal: Document your progress in your Course Journal. Some tasks may ask you to include specific items in your journal. Don't overlook these.
- Insights: If you find something particularly noteworthy about this unit, make a note in your insights! page.
Evaluation
Evaluation: NA
- This unit is not evaluated for course marks.
Contents
Lists
The elements of matrices and arrays all have to be of the same type. Data frames allow us to store elements of different types in columns but all columns have to have the same length. But lists are more generally ordered collections of components. These components can have different type, AND different size.
Lists are created with the list()
function, which works similar to the c()
function. Components are accessed through their index in double square brackets, or through their name, using the "$" operator, if the name has been defined. Here is an example:
pUC19 <- list(size=2686, marker="ampicillin", ori="ColE1", accession="L01397", BanI=c(235, 408, 550, 1647) )
pUC19[[1]]
pUC19[[2]]
pUC19$ori
pUC19$BanI[2]
Note that in the data frame, multiple restriction enzymes were stored in one string, separated by commas. While we can take data like this apart with the strsplit()
function, it is still just one element in the data frame's column.
Further reading, links and resources
Notes
Self-evaluation
If in doubt, ask! If anything about this learning unit is not clear to you, do not proceed blindly but ask for clarification. Post your question on the course mailing list: others are likely to have similar problems. Or send an email to your instructor.
About ...
Author:
- Boris Steipe <boris.steipe@utoronto.ca>
Created:
- 2017-08-05
Modified:
- 2017-09-10
Version:
- 1.0
Version history:
- 1.0 Completed to first live version
- 0.1 Material collected from previous tutorial
This copyrighted material is licensed under a Creative Commons Attribution 4.0 International License. Follow the link to learn more.