[R] Is there any concise way to write a one-to-one mapping?

jpm miao miaojpm at gmail.com
Mon Sep 14 19:35:38 CEST 2015


My code is:



if(type=="none")

  type2<-"nc"

if(type=="drift")

  type2<-"c"

if(type=="trend")

  type2<-"ct"


I am wondering if there's a concise way to write a mapping from type to
type2, especially when the number of categories is high. Thanks!

	[[alternative HTML version deleted]]



More information about the R-help mailing list