Hi,

I have a data frame with multiple columns, which are belong to several
groups
like that:
X1    X2    X3    Y1    Y2    Y3
1232    357    23    0    9871    72
0    71    9    811    795    743
43    919    1111    0    76    14

I would like to filter such rows out, where the sums in one group is lower
than a specifc value. For example, I would like to set all the values in a
group of cloums to zero, if the sum in one group is less than 100
In my example table I would like to set the values in the second row for
the three X-columns to 0, so that the table looks like that:

X1    X2    X3    Y1    Y2    Y3
1232    357    23    0    9871    72
0    0    0    811    795    743
43    919    1111    0    0    0

the same apply also for the Y-values in the last column.
Is there a more efficient way of doing it than going row by row and use the
apply function on each of the subgroups I have in the columns?

thanks
Assa

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to