Hi friends,
Can somebody help me out please?

I have to create a string for a particular if condition , with some
values(returned by function1) which are always variable.

*Step-I* Suppose function1 returns a dataframe like this,shown below with
two values 3 and 4:---
   x
1  3
2  4

*STEP-II  *For creating the string with these values returned by function 1
i have another function2.
These values when passed to function 2 ,returns something like this:---
> source("myscript.R")
[1] "dataset[record_num,item_num]=='3' || dataset[record_num,item_num]=='4'
"
type of the above text prepared is "list"
Say it is text<- dataset[record_num,item_num]=='3' ||
dataset[record_num,item_num]=='4'

*Step-III* Now this 'text ' is passed to another function3 where it is
clubbed to some other  text to prepare a bigger text.
Like this(which will be used as an if-condition later) and then i tried
printing it :--
print ( (text)  || dataset[record_num,item_num]=="NUL" ||
dataset[record_num,item_num]=="" || dataset[record_num,item_num]=="M" )

*ERROR:----*
I keep getting this error:--
Error in (text) || dataset[record_num, item_num] == "NUL" :
  invalid 'x' type in 'x || y'

What i want is this:--

*if ( dataset[record_num,item_num]=="3"  ||
dataset[record_num,item_num]=="4" || dataset[record_num,item_num]=="NUL" ||
dataset[record_num,item_num]=="" || dataset[record_num,item_num]=="M" )*

*I tried doing this in a diffrent way also:--*

*predefined_text<- dataset[record_num,item_num]=="NUL" ||
dataset[record_num,item_num]=="" || dataset[record_num,item_num]=="M"
text was prepared like this:--
text<- dataset[record_num,item_num]=='3' ||
dataset[record_num,item_num]=='4'

ifCondition<-paste(**predefined_text**,**text**,sep=" || ")
**Now say **dataset[record_num,item_num] has value "NULL" so predefined_text
gets value TRUE so if -condition is this:--*
*ifCondition<-paste(**predefined_text**,**text**,sep=" || ")
** print(ifCondition)*

ERROR:---
[1] "TRUE || (dataset[record_num,item_num]=='3' ||
dataset[record_num,item_num]=='4')"
[2] "TRUE || (c(3, 4))"
[3] "TRUE || (list(x = c(3, 4)))"
Error in if (ifCondition) { : argument is not interpretable as logical
In addition: Warning message:
In if (ifCondition) { :
  the condition has length > 1 and only the first element will be used

My desired result,(when *dataset[record_num,item_num] has value "NULL")  *is:--
" *TRUE || (dataset[record_num,item_num]=='3' ||
dataset[record_num,item_num]=='4')* "
Why doesn't this work?

-- 
Thanks in advance
Moumita

	[[alternative HTML version deleted]]

