ㅏ 질문 열 이름 세트 사용에 대해. JSL의 연관 배열을 사용하여 설정 작업을 수행할 수 있습니다. <
// make three sets
rgb = associativearray({"red","green","blue"});
cmy = associativearray({"cyan","magenta","yellow"});
bw = associativearray({"black","white"});
// join them together
all = rgb;
all<<INSERT></INSERT>
질문은 열 이름 집합과 관련하여 제기되었으며 이 예에서는 연관 배열 집합 작업을 사용합니다. <<제거 모든 열 집합과 문자 "i"를 포함하는 열 집합 간의 차이를 구합니다.
// keep only the columns with an "i" in the name
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
allnames = dt << getcolumnnames( "string" );
inames = {};
For( i = 1, i <= N Items( allnames ), i++,
If( Contains( allnames[i], "i" ),
Insert Into( inames, allnames[i] )
)
);
allset = Associative Array( allnames ); // {"name", "age", "sex", "height", "weight"}
iset = Associative Array( inames ); // {"height", "weight"}
allset << Remove( iset ); // the "not i" set...
notinames = allset<<GETKEYS></GETKEYS>
이거 좋은데.이와 같은 연관 배열을 사용할 생각은 없었습니다.과거에 개체 참조 목록을 사용한 상황이 있었고 특정 조건을 충족하는 개체를 제거하기 위해 목록을 검색하고 싶었습니다.목록 작업을 사용하는 것은 상당히 느리고 제어 논리가 복잡했습니다.이것이 어떻게 훨씬 더 쉬워지는지 알 수 있습니다.나중에 참조할 수 있도록 내 "JSL 컬렉션"에 추가할 예제 코드를 복사하여 붙여넣고 있습니다!