cfss-old / fp-EmilyForden

fp-EmilyForden created by GitHub Classroom
0 stars 0 forks source link

Parse Number #2

Open EmilyForden opened 7 years ago

EmilyForden commented 7 years ago

Currently, my data looks like this:

Book Chapter    sentiment     n n_total        pct livy_id
   <chr>   <chr>        <chr> <int>   <int>      <dbl>   <int>
1 Book 1 Preface        anger     9     237 0.03797468       1
2 Book 1 Preface anticipation    21     237 0.08860759       1
3 Book 1 Preface      disgust     6     237 0.02531646       1
4 Book 1 Preface         fear     9     237 0.03797468       1
5 Book 1 Preface          joy    15     237 0.06329114       1
6 Book 1 Preface     negative    29     237 0.12236287       1

I'm trying to parse the number out of my Book column so I am running:

parse_number(Book, na = c("", "NA"), locale = default_locale())

It isn't working. I must be missing how to parse from a specific column.

Once I get that figured out, I need to deal with scale_x_continuous. I think it will be something like:

scale_x_continuous(name = Books, breaks = 5)

Does that sound about right?

bensoltoff commented 7 years ago
Livy <- read_csv("All_Livy.csv") %>%
  mutate(Book = parse_number(Book))

Just convert Book as soon as you import. Drop all the extra arguments and it should be fine.

As for scale_x_continuous, I think that will draw a tick mark at 5. To draw at every five marks, create a sequence using the seq function. Like seq(from = 1, to = 36, by = 5)