2016年7月21日木曜日

Convert diff(GDPC96) into boolean vector

Convert diff(GDPC96) into boolean vector.


> output <- c();for(i in seq(2,length(as.numeric(diff(GDPC96["2001::"]))),1)){if(as.numeric(diff(GDPC96["2001::"])[i]) > 0 ){output <- append(output,0) }else{output <- append(output,-1)}}
> output
 [1]  0 -1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 -1  0 -1 -1 -1 -1  0  0  0  0  0  0 -1  0  0  0  0  0  0  0  0  0  0  0 -1  0  0  0  0  0  0  0  0

0 件のコメント: