R Studio 2024.04.2+764 (2024.04.2+764)
I am trying to create a new column with a dummy code of either 1 or 0 for whether or not an event occurred within 60 minutes or less. 1 for if it occurred in 60 minutes or less and 0 if it occurred in greater than 60 minutes. I can see from the output that some of the output is wrong. For example one event that occurred in 7 minutes has an output of 0. Similar all the events that occurred in greater than 106 minutes are coded as 1. All of the rest of the output looks correct. There are NA’s in my data set and they all are coded correctly as NA in the new column.
This is the code I used.
data <- data |>
mutate(new_column = case_when(
source_column <= "60" ~ 1,
source_column >= "61" ~ 0,
))
These are the packages that I have loaded.
library(tidyverse)
library(dplyr)
library(dbplyr)
library(readr)
library(lme4)
Brian Burns is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.