New Variable column for dataframe

I'm solving the following problem: Create a variable (column) in the “wf” dataframe named “Zone” that takes value of “tropic” if Latitude is less than or equal to 30, or “non-tropic” for Latitude greater than 30. Show you Zone variable. Latitude is a column of my dataframe. I don't know the sintaxis and the process to create the column.

example of basic syntax.

(hiris <- head(iris))

hiris$newval <- ifelse(hiris$Sepal.Length>4.7,
                       "yes",
                       "no")
hiris

You might benefit from trying to learn R with swirl
https://swirlstats.com/

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.