error: in rep(yes, length.out = len) , how can i fix this

Hello

i have a dataset like:

 Datum            Region   Betrag Betragin  Betragout     Diff group

1 2014.10.15 america 2146733 2146733 0.0 2146733 1
2 2014.10.15 Africa -322394 0 -322400.0 -322400 1
3 2014.10.15 asia 1231273 6621332 -5390074.6 1231257 1
4 2014.10.15 Spain -2255851 2719620 -4975470.0 -2255850 1
5 2014.10.15 Swiss 1961510 2861038 -899528.3 1961510 1
6 2014.10.15 Australia -1166936 3261793 -4428733.0 -1166940 1

names(dataset) <- c("Datum", "Region", "Betrag", "Betragin", "Betragout", "Diff") #Rename
dataset$group <- c(1)
dataset[is.na(dataset)] = 0
ds_out<-as.numeric(rbind(df$Betragout)) #vectorization
ds_in <- as.numeric(rbind(df$Betragin)) #vectorization


ggplot(dataset)+
 geom_bar(mapping = aes(x=substr(Datum,start=1,stop=8), y=Betragin/1000000, fill="Betragin/1000000"), stat="identity",, width=0.8)+
  geom_bar(mapping= aes(x=substr(Datum,start=1,stop=8), y=Betragout/1000000, fill="Betragout/1000000"), stat="identity", width=0.8)+
  geom_point(mapping= aes(x=substr(Datum,start=1,stop=8), y=Diff/1000000, group=group, fill="Diff/1000000"), color="NA", size=1) +
  geom_line(mapping= aes(x=substr(Datum,start=1,stop=8), y=Diff/1000000, group=group, fill="Diff/1000000"), color="#666666", size=1)+
  theme_gray(base_size=12)+
    labs(x="",y="CHF in Mio.")+

ifelse(ds_in/1000000<1 | ds_out/1000000>-1,  #check if value is lager or smaller than 1, if yes, do scaling by 0.05, if no, by 0.5
      scale_y_continuous(breaks = seq(-100000,100000, by=0.05)),
    scale_y_continuous(breaks = seq(-100000,100000, by=0.5), minor_breaks=seq(-100000,100000, by=0.1))

then i get the error
Fehler in rep(yes, length.out = len) :
attempt to replicate an object of type 'environment'

what does this mean? and how can i fix this?

thanks

Two few names (6) for the number of columns (7). Come back if you have other problems. Please see the reprex FAQ guideliune. Here's a dput to get started with

suppressPackageStartupMessages({
  library(ggplot2)
})

dataset <-
  structure(list(Datum = c(
    "2014.10.15", "2014.10.15", "2014.10.15",
    "2014.10.15", "2014.10.15", "2014.10.15"
  ), Region = c(
    "america",
    "Africa", "asia", "Spain", "Swiss", "Australia"
  ), Betrag = c(
    2146733,
    -322394, 1231273, -2255851, 1961510, -1166936
  ), Betragin = c(
    2146733,
    0, 6621332, 2719620, 2861038, 3261793
  ), Betragout = c(
    0, -322400,ds_out<-as.numeric(rbind(df$Betragout)) #vectorization
    ds_in <- as.numeric(rbind(df$Betragin)) #vectorization
    -5390074.6, -4975470, -899528.3, -4428733
  ), Diff = c(
    2146733,
    -322400, 1231257, -2255850, 1961510, -1166940
  ), group = c(
    1,
    1, 1, 1, 1, 1
  )), class = c("spec_tbl_df", "tbl_df", "tbl", "data.frame"), row.names = c(NA, -6L), spec = structure(list(cols = list(
    Datum = structure(list(), class = c(
      "collector_character",
      "collector"
    )), Region = structure(list(), class = c(
      "collector_character",
      "collector"
    )), Betrag = structure(list(), class = c(
      "collector_double",
      "collector"
    )), Betragin = structure(list(), class = c(
      "collector_double",
      "collector"
    )), Betragout = structure(list(), class = c(
      "collector_double",
      "collector"
    )), Diff = structure(list(), class = c(
      "collector_double",
      "collector"
    )), group = structure(list(), class = c(
      "collector_double",
      "collector"
    ))
  ), default = structure(list(), class = c(
    "collector_guess",
    "collector"
  )), skip = 1L), class = "col_spec"))