trying to plot the following function over the interval [-1,1] but am getting error code:
"Warning messages:
1: In if (g < a) { :
the condition has length > 1 and only the first element will be used
2: In if (g >= a & g <= b) { :
the condition has length > 1 and only the first element will be used"
unifCDF<-function(g) {
if (g< a) {
0
}
else if (g>=a & g<=b) {
(g-a)/(b-a)
}
else if (g>b) {
1
}
}
I know the function itself works since unifCDF() works for all values I tested. Any ideas?
Aucun commentaire:
Enregistrer un commentaire