Hi,
I have a dataset for monitoring teachers. We have some goals to be fulfilled, hence score is given for each goal according to performance. In the sample I have given below scoring is 1 or 0.5 or -1.
But I want the scores to be replaced as follows:
-1 to 0, 0.5 to 0.
1 will remain as 1.
How can I achieve this?
library(tidyverse)
library(janitor)
#>
#> Attaching package: 'janitor'
#> The following objects are masked from 'package:stats':
#>
#> chisq.test, fisher.test
data<-tibble::tribble(
~instructor, ~teacher, ~goal1, ~comments, ~goal2, ~comments, ~goal3, ~comments, ~goal4, ~comments,
"A", "P", -1, "ACCA", 0.5, "GSJD", 1, "RGTH", 1, NA,
"B", "Q", 1.5, "CGSJJ", 0.5, "NNDK", 1, "QWERT", 1, NA,
"C", "R", -1, "NSH", 1, "SMSF", 1, "CRFT", 0.5, NA,
"D", "S", 1, NA, -1, NA, 0.5, "SSSSA", 0.5, NA,
"E", "T", 1, NA, 0.5, NA, 0.5, NA, -1, NA,
"F", "U", 0.5, "SBHF", 0.5, "DNJAD", -1, NA, -1, NA,
"G", "V", -1, "DHFG", 1, "DFHY", -1, "DFHU", 0.5, NA,
"H", "W", 0.5, NA, 1, NA, 0.5, NA, 1, NA,
"I", "X", -1, "DHFG", -1, NA, -1, NA, 1, NA,
"J", "Y", -1, "SAYHT", -1, "SRGO", 1, "SRTUU", 0.5, NA
)
Created on 2022-09-20 by the reprex package (v2.0.1)