COUNTIF function using fixed column range in R

How do I write below excel function in R?

=IF(OR(COUNTIF($Q4:$CG4, BL$6)>0, COUNTIF($Q4:$CG4, BL$6 & “w/ HRA”)>0), 1, 0)

So, I have a data frame in R ‘qryMDV1’ with 193 rows and 92 columns. Few column names are same but have different values. Now, I would like to look for a fixed value ( BL$6 in our case ) for example, ‘Hyundai’ or ‘Hyundai star’ under column 19 to 88 ($Q4:$CG4 in excel). in our data frame qryMDV1. If ‘Hyundai’ or ‘Hyundai with Star’ exist in column 19 to 88 for each row than calculate the count and if that is greater than 0 assign value ‘1’ otherwise ‘0’!

please refer to sample input data and desired output data.

Rcode1|565x500

Hi,

try this =IF(OR(IF(COUNTIF(A4:E4,“Hyundai”)>0,1,0),IF(COUNTIF(A4:E4,“Hyundai star”)>0,1,0)),1,0)

How do I write this code in R?