Skip to content
Back to formatted view

Raw Message

Message-ID: <1341231992.1809.YahooMailNeo@web39404.mail.mud.yahoo.com>
Date: 2012-07-02T12:26:32Z
From: arun
Subject: Decrete value check in a matrix
In-Reply-To: <38C6A6C462AAFB4991A50F715B07A59B0F76F297@BANMLVEM05.e2k.ad.ge.com>

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.

________________________________
From: "Akkara, Antony (GE Energy, Non-GE)" <Antony.Akkara at ge.com>
To: arun <smartpink111 at yahoo.com> 
Sent: Monday, July 2, 2012 7:29 AM
Subject: Decrete value check in a matrix 


Hi Arun,

Can you please help me,

Here i have a Data frame (or) Matrix like this, 

MyMatrix <- 

ABC ? ? ? ? ?XYZ 
------ ? ? ? ?------- 
1 ? ? ? ? ? ? ?2.5 
3.4 ? ? ? ? ? 4 
5 ? ? ? ? ? ? ?6 
5.6 ? ? ? ? ?6.7 

Here i need to check each column value having decrete value or not ?. 
If that particular coulmn-value having decrete value, then the result should be 
TRUE/FALSE respectively in the result column. 
Finally, i need to get the result as ?Dataframe (or) Matrix form like this 

ABC ? ? ? ? ?XYZ ? ? ?ABC_RESULT ? ? ? ? ? ? ? XYZ_RESULT 
------ ? ? ? ?------- ? ? -------------------- ? ? ? ? ? ? -------------------- 
1 ? ? ? ? ? ? ?2.5 ? ? ? ? ? ? ? ? TRUE ? ? ? ? ? ? ? ? ? ? ? FALSE 
3.4 ? ? ? ? ? 4 ? ? ? ? ? ? ? ? ? ?FALSE ? ? ? ? ? ? ? ? ? ? TRUE 
5 ? ? ? ? ? ? ?6 ? ? ? ? ? ? ? ? ? ?TRUE ? ? ? ? ? ? ? ? ? ? ? ?TRUE 
5.6 ? ? ? ? ?6.7 ? ? ? ? ? ? ? ? ?FALSE ? ? ? ? ? ? ? ? ? ? FALSE 

- Can any one solution fast. Its urgent thtz y. 

Antony.??