Issues with the blood pressure case study in Hadley Wickham's book ggplot2 Elegant Graphics for Data Analysis

Hello i am a beginner in R and i am dealing with this problem several days. I have downloaded Hadley Wickham's book called ggplot2 Elegant Graphics for Data Analysis and i practise this problem. I want to tidy my data but all comes in one column and i do not know how to separate what's inside my table. I am familliar with the tidy data principles( variables in columns , observations in rows and values in cells), but i do not understand what i do wrong. Any help?
Thank you

bpd <- readr::read_table(
    "name age start week1 week2 week3
Anne 35 2014-03-27 100/80 100/75 120/90
Ben 41 2014-03-09 110/65 100/65 135/70
Carl 33 2014-04-02 125/80 <NA> <NA>
", na = "<NA>")

You could separate by spaces, but I think it's easier to just read it in with a space as the separator to begin with:

bpd <- readr::read_delim("name age start week1 week2 week3
Anne 35 2014-03-27 100/80 100/75 120/90
Ben 41 2014-03-09 110/65 100/65 135/70
Carl 33 2014-04-02 125/80 <NA> <NA>", delim = " ", na = "<NA>")
bpd
#> # A tibble: 3 x 6
#>   name    age start      week1  week2  week3 
#>   <chr> <dbl> <date>     <chr>  <chr>  <chr> 
#> 1 Anne     35 2014-03-27 100/80 100/75 120/90
#> 2 Ben      41 2014-03-09 110/65 100/65 135/70
#> 3 Carl     33 2014-04-02 125/80 <NA>   <NA>

Created on 2020-04-27 by the reprex package (v0.3.0.9001)

Thank you @mara . Now i can move on

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.