0
N <- 300
N.2 <- 800
N.3 <- 600
change.y <- c(N, N.2, N.3)
use.y <- which.max(change.y)
graph.ylim <- use.y + 100
la sortie est [2], qui est technnically correcte, mais je veux dire la sortie 800, et non 2. Ensuite, je veux brancher use.y comme y-lim ici :which.max fonction
coord_cartesian(xlim = c(0:300), ylim = c(150:900)) +
...
Est-ce que quelqu'un sait comment faire cela? Quand je branche ylim = c (150: graph.ylim)) mon graphique disparaît.
Vous voulez 'max', pas' which.max'. – Lyngbakr
Je recommande également d'utiliser 'max()'. Mais si vous insistez pour utiliser 'which.max()', votre dernière ligne devrait être 'use.y <- change.y [which.max (change.y)]'. La fonction 'which.max()' renvoie un index, il doit donc être appelé dans un objet pour référencer une position. –