w*******n 发帖数: 469 | 1 My point is not to write a code like the following, which looks so complicated, but like the code in SAS,"select ...case 1....when....then... "
if a=1 then
b=x1
c=x2,
d=x3.
if a=2 then
b=x4,
c=x5,
d=x6.
if a=3 then
b=x7,
c=x8,
d=x9. | D******n 发帖数: 2836 | 2 why not? not sure what u mean though. | t**i 发帖数: 688 | 3 switch
complicated, but like the code in SAS,"select ...case 1....when....then...
"
【在 w*******n 的大作中提到】 : My point is not to write a code like the following, which looks so complicated, but like the code in SAS,"select ...case 1....when....then... " : if a=1 then : b=x1 : c=x2, : d=x3. : if a=2 then : b=x4, : c=x5, : d=x6. : if a=3 then
| l*******D 发帖数: 282 | | G**Y 发帖数: 33224 | 5 x = c(x1, ..., x9);
groups = c(1, 1, 1, 2, 2, 2, 3, 3, 3);
idx = (groups %in% a);
y = x[idx];
b = y[1];
c = y[2];
d = y[3];
complicated, but like the code in SAS,"select ...case 1....when....then... "
【在 w*******n 的大作中提到】 : My point is not to write a code like the following, which looks so complicated, but like the code in SAS,"select ...case 1....when....then... " : if a=1 then : b=x1 : c=x2, : d=x3. : if a=2 then : b=x4, : c=x5, : d=x6. : if a=3 then
|
|