In the attached image I want to replace -1 by -Inf and 3 by Inf.
This is the code:
<code>library(ggplot2)
F <- function(x){
f <- NULL
f[x<0] <- 0
f[x>=0 & x<1] <- 0.4*x[x>=0 & x<1]^2
f[x>=1 & x<2] <- 0.2*x[x>=1 & x<2]^2+(0.2)
f[x>=2] <- 1
f
}
x <- seq(-1, 3, 0.01)
plot(x, F(x), type="l", las=1)
</code>
<code>library(ggplot2)
F <- function(x){
f <- NULL
f[x<0] <- 0
f[x>=0 & x<1] <- 0.4*x[x>=0 & x<1]^2
f[x>=1 & x<2] <- 0.2*x[x>=1 & x<2]^2+(0.2)
f[x>=2] <- 1
f
}
x <- seq(-1, 3, 0.01)
plot(x, F(x), type="l", las=1)
</code>
library(ggplot2)
F <- function(x){
f <- NULL
f[x<0] <- 0
f[x>=0 & x<1] <- 0.4*x[x>=0 & x<1]^2
f[x>=1 & x<2] <- 0.2*x[x>=1 & x<2]^2+(0.2)
f[x>=2] <- 1
f
}
x <- seq(-1, 3, 0.01)
plot(x, F(x), type="l", las=1)