Displaying 2 results from an estimated 2 matches for "sum_negative".
2010 Jul 14
1
rows process in DF
I have the following datasets:
id d1 d2 d3 d4 d5 d6 d7 d8
1 100 0.3 0.4 -0.2 -0.3 0.5 0.6 -0.9 -0.8
2 101 0.3 0.4 0.5 0.6 -0.2 -0.4 -0.5 -0.6
what I am trying to accomplish:
loop through the rows && do the following:
if the values from the columns of the current row >0 then
sum_positive=total
if the values from the columns of the current row <0 then
2010 Jul 27
4
re-sampling of large sacle data
....166910351 0.022304377 -0.00825924 0.008330689 -0.168225938
-0.166910351 0.022304377 -0.00825924 0.008330689 -0.168225938
-0.166910351 0.022304377 -0.00825924 0.008330689 -0.168225938
per the dataframe above,
step 1: do the following
doit=function(x)c(sum_positive=sum(x[-1][x[-1]>0]),sum_negative=sum(x[-1][x[-1]<0]))
pos_neg_pool<-t(apply(myDF,1,doit))
if not first run then append the data to the pos_neg_pool
step2: reshuffle the data by columns then do step1, this step need to run
10000 times;
output will be 23*10000=230,000 rows.
Can anyone point out how to a...