for 루프를 사용하지 않고 선택한 행에 일련의 값을 할당하는 방법은 무엇입니까?안녕, 모두
get rows where()를 사용하여 일련의 행을 가져오고 아래와 같이 b열 아래의 행에 있는 값을 다른 열 아래의 동일한 행에 할당하려고 합니다.
행 = dt << 행을 가져옵니다. 여기서 (column("b")[ ] == "xxx");
열("a")[행] = 열("b") [행];
그러나 작동하지 않습니다. for 루프를 사용하지 않고 선택한 행에 일련의 값을 할당하는 방법이 있는지 알고 싶습니까?
감사합니다스크립팅Re: for 루프를 사용하지 않고 선택한 행에 일련의 값을 할당하는 방법은 무엇입니까?다음은 문제를 해결하는 한 가지 방법을 보여주는 예입니다.
names default to here(1);
dt=open("$sample_data/big class.jmp");
// Create a new table with the same number of rows and a new
// character column called Gender
dtNew = New Table("New Table", add rows(nrows(dt)),
New Column("Gender",character)
);
// Assign to all rows in big class that are females, the value
// of "Female" to the same rows in New Table
dtNew:Gender[dt<<GET rows="" where=""></GET>Re: for 루프를 사용하지 않고 선택한 행에 일련의 값을 할당하는 방법은 무엇입니까?답장을 보내 주셔서 감사합니다.
그러나 "특정 값"을 지정하는 대신 for 루프 없이 해당 행에 "일련의 값"을 지정하고 싶습니다.Re: for 루프를 사용하지 않고 선택한 행에 일련의 값을 할당하는 방법은 무엇입니까?다른 사람들은 이 작업을 더 효율적으로 수행할 수 있지만 여기에 내 솔루션이 있습니다.
names default to here(1);
dt=open("$sample_data/big class.jmp");
// Create a new table with the same number of rows and a new
// character column called Gender
dtNew = New Table("New Table", add rows(nrows(dt)),
New Column("Gender",character)
);
// Assign to all rows in big class that are females, the value
// of "Female" to the same rows in New Table
values = dt:sex << get values;
dtNew:Gender << set values(values);
dtNew:Gender[dt<<GET rows="" where=""></GET>