I have a data frame:

```
df <- structure(list(LAST = c(3.4, 2.52, 1.82, 1.16, 0.69, 0.36, 4, 
3.21, 2.54, 1.93), CURRENTPRICE = c(464.16, 464.16, 464.16, 464.16, 
464.16, 464.16, 464.16, 464.16, 464.16, 464.16), STRIKEPRICE = c(461, 
462, 463, 464, 465, 466, 461, 462, 463, 464), YEARSTOEXPIRATION = c(0.00273972602739726, 
0.00273972602739726, 0.00273972602739726, 0.00273972602739726, 
0.00273972602739726, 0.00273972602739726, 0.010958904109589, 
0.010958904109589, 0.010958904109589, 0.010958904109589)), row.names = c(NA, 
-10L), class = c("data.table", "data.frame"))

```

I am trying to create a new column calculating implied volatility for each row using data from each row and using the AmericanOptionImpliedVolatility function from the RQuantLib package:

```
df$IMPLIEDVOLATILITY <- AmericanOptionImpliedVolatility(type="call", value=df$LAST, underlying=df$CURRENTPRICE, strike=df$STRIKEPRICE, dividendYield=0.00, riskFreeRate=.03, maturity=df$YEARSTOEXPIRATION, volatility=0.2)

```

I know that the code is wrong and I accordingly get an error message:

"Error in americanOptionImpliedVolatilityEngine(type, value, underlying, : Expecting a single value: [extent=10]."

How do I correctly use the "AmericanOptionImpliedVolatility" function with the row values as variables to create a new column with that resulting value?