Week 3 - Learning Lists
What's a list in R?¶
You became expert in vectors and know how to manipulate them. It's time now to learn a more complex one dimensional R structure: the lists! Thanks to them you can store heterogeneous data. To learn more about them, how to create and manipulate them, go to the list page in the reference manual.
Let's Practice¶
For each week, you'll have a set of exercises that you must render in an R script.
After that you need to complete the following google form to answer some MCQ (Multiple
Choice Questions) where the final question is to deposit your R script.
Please note that an Rscript has the extension .R
but it's not supported by Google Form.
To avoid this inconvenience, you need to add the .txt
extension to make your file named as: NAME_week3_script.R.txt
.
Do it yourself!
- 1. Create a list with vectors (numeric, character and logical) of length 15, 8 and 10 respectively. Don't hesitate to use R functions to create them without having to write them in hard copy (like :
hardcopy_vec <- c("it's", "not", "very", "effective", "that", "way")
).- The numeric vector must follow a binomial distribution
- The character vector is the last 8 letters of the alphabet in capital
- The logical vector is composed as many true values as false in the order of your like but remember not written in hard copy!
- 2. Add names for each element of your list.
- 3. Retrieve the character vector from your list.
- 4. Retrieve the 4th value of the logical vector from your list.
- 5. Remove positive elements of the numerical vector from your list.
- 6. Filter to keep only false value of the logical vector from your list.
- 7. Create a function that generate a random DNA sequence of a specified length (example, for a length 7 you must obtain :
ATCGATC
) - 8. Create a list of 4 random DNA sequences with a random number between 10 and 200 bases (don't hard copy the length) called human, mouse, chicken, fly
- 9. Compute the number of bases of each sequences
- 10. Test of many sequences had more than 50 nucleotides
- 11. Filter the list to keep only non mammals sequences
Please be aware of the best practices for your Rscript, we will be attentive to them!
Now you can fill the following quiz: Quiz of week 3.
Thank you for your attention and see you next week