# create a variable (rowsums) by condition

#### jfca283

##### Member
Hello,
I am wondering if it is possible to compute a rowsums using a list, and also, filter the sum by a condition from a third variable.
I thoght in something as

ghj : data frame
list_g=("va1","va2",var3")

ghj$jkj[ ghj$var4=10 ]=apply(ghj[,list_g],1,rowsums)

The syntax before clearly doesn't work.
Can you guide me?
Thanks