dummy coding Categorical variable


hey can someone help with that? trying to creat dummy coding to Categorical variable

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

You need to create column "c1" before you can replace it. For example

data$c1 <- NA

or you create it and fill it at once, like this

data$c1 <- ifelse(data$x %in% c("anxifree",  "placebo"), -0.5, NA_real_)

Also you have spelled placebo wrongly.

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.