Box-Cox Transformation

Hi! I have to do the Box-Cox transformation to normalize my air quality data set. I have different meteorological stations, so I tried to include this normalization in a function, but I still have errors. For that reason, I did the box-cox transformation for each station as you can see in the image. Please, I would like to do just one function that repeats the same process for all the columns.

Thanks for the help!

It's extremely difficult to see your code from a picture. Please share codes in a copy-paste friendly form, by copying the code and pasting within a pair of triple backticks like this:

<paste code here>

Regarding your question, since you have the form of the function you desire to create, the easiest option will be to write a custom function. This should be easy, you just need to copy paste a single block within function definition with changing dataframe_name[column_name] or dataframe_name[column_position] to a placeholder variable name which is the argument. Then just use it on different column using lapply, or purrr:map if you are a tidyverse person.

Give it a try and see if it works. If you are getting stuck somewhere, please share your attempt and the issue as a reprex.

Hope this helps.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.