Error in a - b : non-numeric argument to Binary Operator

Asked

Viewed 490 times

0

Q

    {r}

    cambio2 <- data.frame(cambio)

    cambio2 %>%
      ggplot(aes(y = receita,
                 x = despesa
                          )
    ) + geom_point()

I want to make the chart, but there are no dots in the chart and the following error appears:

Error in a - b : non-numeric argument to Binary Operator

Thanks in advance

  • Present a sample of your data so we can understand what kind of problem is occurring. Use dput(cambio2) to get the sample and edit the post with that output.

2 answers

0

Follow the data:

month year revenue expense 1 1 2018 778.7376 1579.185 2 2 2018 611.4827 1362.005 3 3 2018 544.0717 1532.969 4 4 2018 498.8309 1324.723 5 5 2018 428.6952 1496.460

inserir a descrição da imagem aqui Thanks in advance.

0


I believe that’s what you wanted, correct?

lines = 'mês ano receita despesa 
1 2018 778.7376 1579.185 
2 2018 611.4827 1362.005 
3 2018 544.0717 1532.969 
4 2018 498.8309 1324.723 
5 2018 428.6952 1496.460'

dados = read.table(textConnection(lines), header = T)

library(dplyr)
library(ggplot2)

dados %>%
  ggplot(aes(y = receita, x = despesa)) +
  geom_point()

map

  • I ran your syntax in Rstudio and R console and the error repeats. Error in a - b : non-numerical argument for binary operator

  • Are you running the script as ". R" or as ". Rmd"? It would be easier for you to put a screen print to evaluate the error.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.