79095732

Date: 2024-10-16 20:36:22
Score: 1
Natty:
Report link

One way with base R:

df = data.frame(Count = c(1, 2, 3, 4, 5))
# Use the modulo operator to return the remainder of dividing by 2
df$evenodd <- df$Count %% 2
# Relabel 0 = Even, 1 = Odd
df[df$evenodd == 0,]$evenodd = "Even"
df[df$evenodd == 1,]$evenodd = "Odd"
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Noah Fahlgren