0

I use this codes to solve a problem in R. f(a)= |x|+5a-6, where |x|. will it be right to plot the value of merge. I am getting a straight line.

merge <- function(x) {
  y <- abs(a) + 5*(a)-6  
  return(y) 
}

merge (-4.534)

#c. Obtain the graph of the function.

plot (merge) 
merge <- function(x) {
  y <- abs(a) + 5*(a)-6  
  return(y) 
}

merge (-4.534)

#c. Obtain the graph of the function.

plot (merge)

1 Answers1

0

Your function has no value. You have to provide arguments. Try:

x <- seq(-100, 100)
merge <- function(a) {
  y <- abs(a) + 5*(a)-6  
  return(y) 
}
merge(x)
plot(x, merge(x))
eastclintw00d
  • 2,250
  • 1
  • 9
  • 18