Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse Number #2

Open
EmilyForden opened this issue Dec 7, 2016 · 1 comment
Open

Parse Number #2

EmilyForden opened this issue Dec 7, 2016 · 1 comment

Comments

@EmilyForden
Copy link
Contributor

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
Copy link
Contributor

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants