reprsentation graphique

salut chers collègues
comment représenter la fonction suivante

grade <- function(x) {if (x>0 & x<1/2) {8*x/3} else if (x>=1/2 & x<1) { 4/3} else {0
}}

Hi @mamady_rst

you can try something like this:

x <- c(seq(0, 1, by = 0.01), 1:2)
y <- purrr::map_dbl(x, grade)
ggplot2::ggplot() +
  ggplot2::geom_line(aes(x,y))

salut
quand j'exécute la commande
y <- purrr::map_dbl(x, grade), j'ai le message d'erreur suivant:
Error in loadNamespace(name) : aucun package nommé ‘purrr’ n'est trouvé

Please use English here, by using French you are excluding most people from the conversation.

That error message is telling you that you don't have the purrr package installed, so if you want to use it, you have to install it first

install.packages("purrr")

when I execute the command:
y<- purrr :: map_dbl (x, grade). I get the following error message

Error in loadNamespace(name) : aucun package nommé ‘purrr’ n'est trouvé

please how to install purrr

With the command I gave you

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.