Unexpected Token Error on %>%

Hi i am new to rstudio and try to use the Code on this website.

i get an error on this part:

Fix structure for 2d CNN

train_array %
layer_dropout(rate = 0.25) %>%

layer_flatten() %>%
layer_dense(units = 50, activation = "relu") %>%
layer_dropout(rate = 0.25) %>%
layer_dense(units = 1, activation = "sigmoid")

summary(model)

model %>% compile(
loss = 'binary_crossentropy',
optimizer = "adam",
metrics = c('accuracy')
)

history % fit(
x = train_array, y = as.numeric(trainData$y),
epochs = 30, batch_size = 100,
validation_split = 0.2
)

plot(history)

There is an error on each line with %>% and on each line with %. It says unexpected Error > and unexpected Error %.

i tried to install dplr and magrittr, but it doesn't work. I use the latest Version of rstudio.

regards

In the website you refer to I see as code

history <- model %>% fit(
      x = train_array, y = as.numeric(trainData$y), 
      epochs = 30, batch_size = 100, 
      validation_split = 0.2
)

Therefore I think you made some copying error or more probably a 'find and replace' error.

I do not know a dplr package but of course there is the dplyr package. In the article these packages are not mentioned explicitly. If you get no error messages on the library statements at the beginning of the article I assume that all necessary packages are available.