Skip to content

Decrete value check in a matrix

1 message · arun

#
Hi,

Try this:

dat1<-read.table(text="
ABC????????? XYZ???? 
1????????????? 2.5
3.4?????????? 4
5????????????? 6
5.6????????? 6.7
",sep="",header=TRUE)

dat1[dat1$ABC ==as.integer(dat1$ABC), "ABC_RESULT"]<-TRUE
dat1[dat1$XYZ== as.integer(dat1$XYZ),"XYZ_RESULT"]<-TRUE
dat1[is.na(dat1)]<-FALSE
dat1
? ABC XYZ ABC_RESULT XYZ_RESULT
1 1.0 2.5?????? TRUE????? FALSE
2 3.4 4.0????? FALSE?????? TRUE
3 5.0 6.0?????? TRUE?????? TRUE
4 5.6 6.7????? FALSE????? FALSE

A.K.