Remember, you can get help to any R-function by typing e.g. ?str_c
in the console
inner_join()
, left_join()
, right_join()
, full_join()
, semi_join()
and anti_join()
on x
and y
as defined below? (Discuss before running any code!)x <- tribble(
~key, ~val_x,
1, "x1",
2, "x2",
3, "x3"
)
y <- tribble(
~key, ~val_y,
1, "y1",
2, "y2",
4, "y3"
)
sample()
in conjugation with str_c()
to create a function, which can return a random dna string of length n
, run the function with n = 100
and save the output to my_dna
- What fraction of the dna you created is adenine?str_*
function to change my_dna
to my_rna
- How many start codons did you get?my_dna
and save them in seperate variables - which amino acid do they encode? (Do not trqnslate the entire sequence, just look the codons up using google)my_dna
and randomly choose 3 nucleotides forming a codon, hardcode them to a variable and now, split my_dna
on those - What is returned?factor(LETTERS)
and factor(rep(LETTERS, 10))
, inspect the output and discuss what is going on with your desk-buddy?factor(rev(LETTERS))
, factor(rev(LETTERS), levels = LETTERS)
and factor(rev(LETTERS), levels = rev(LETTERS))
, inspect the output and discuss what is going on with your desk-buddy?Download this data I prepared to your computer, then upload it in your data folder in your RStudio cloud session.
readr
, which function reads the file types you uploaded? (Hint: Try typing readr::r
and then hit the TAB
key in the console)join_*
function(s) to re-create the diabetes
data from last sessionThe original data had the following variables:
id chol stab.glu hdl ratio glyhb location age gender height weight frame bp.1s bp.1d bp.2s bp.2d waist hip
Last session we worked with select()
. This function has derivatives, one of which is select_if()
.
dplyr::select_if()
- What does this function do?id
variable (saving into the variable diabetes_data_long
) and re-create the facetted plot below - What is on the x-axis and what is on the y-axis?Q17: Take a good look at the plot - Can you come up with a better way of representing the data recorded for each numerical variable?
Q18: Use the original diabetes_data
to join back the gender
to the long data you created and redo the plot, colouring for gender
Q19: Could you have included the gender
variable, when you originally created the long data and if so how?