I want to write code that says "If you find an element equal to 4 in this
vector for each person in the data set tested separately, then put in 1 for
2 and 2 for 4, else leave the variable as is"

 u.ppl <- (unique(init.dat1$grid))
      l.ppl <- length(u.ppl)
        for (i in 1:l.ppl)
        {
          if (grep("4",init.dat1$Slide1_RESP)) {2 == 1, 4 == 2}; else
init.dat1$Slide1_RESP

        }

-- 
Edward H. Patzelt
Research Assistant – TRiCAM Lab
University of Minnesota – Psychology/Psychiatry
VA Medical Center
Office: S355 Elliot Hall - Twin Cities Campus
Phone: 612-626-0072  Email: patze...@umn.edu

Please consider the environment before printing this email
www.psych.umn.edu/research/tricam

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to