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

Help with Error #2

Open
Makeo88 opened this issue Sep 10, 2019 · 1 comment
Open

Help with Error #2

Makeo88 opened this issue Sep 10, 2019 · 1 comment

Comments

@Makeo88
Copy link

Makeo88 commented Sep 10, 2019

Hello

Any ideas why i might be getting this error:

Error in -value : invalid argument to unary operator

When running

install.packages("tidyverse")
install.packages("janitor")
install.packages("gganimate")

library(tidyverse)
library(janitor)

material <- read_csv("tidymat2.csv")

library(tidyverse)
library(gganimate)

##This bit is for filtering to the top 10

mat_formatted <- material %>%
group_by(year) %>%

The * 1 makes it possible to have non-integer ranks while sliding

mutate(rank = rank(-value),
Value_rel = value/value[rank==1],
Value_lbl = paste0(" ",round(value/1e9))) %>%
group_by(material_type) %>%
filter(rank <=10) %>%
ungroup()

mat_formatted looks like:

material_type value year

1 AC 11.40% 1900
2 CI 3.20% 1900
3 CICL 2.30% 1900
4 CONC 0.00% 1900
5 COPPER 0.70% 1900
6 DI 0.00% 1900
7 DICL 0.90% 1900
8 DIEL 0.00% 1900
9 GI 4.60% 1900
10 GICL 0.00% 1900

Etc

Thanks

@fiastros
Copy link

fiastros commented Dec 6, 2021

In you column value: i think you mixted the characters with numeric values. it shoud be two seperate columns.

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