How to use boxcox function in R

I run the following code in R:

boxcox(data, lambda = seq(-2,2), interp=TRUE, plotit=TRUE)

Where data is a vector of integers, but I get the error

Error: $ operator is invalid for atomic vectors

How can I fix this? Furthermore, how can I specify how much I want the lambda to increment by?


When you're posting code, dataframes or computer output it's helpful to wrap this information in code tags by:
  1. either clicking the pound (#) sign icon or
  2. wrap with [NOPARSE]
    some code

which produces:
some code
For more see this (LINK)