스크립트를 사용하여 하위 집합을 별도의 폴더에 저장하는 방법파일을 가져오고 엑셀화하고 3개의 하위 집합을 생성하는 분석을 수행하는 스크립트를 만들었습니다. 각 하위 집합은 다른 폴더여야 하지만 하위 집합을 만들기 위해 가져온 Excel 파일과 이름이 같은 하위 집합을 원합니다. 이 작업을 수행하거나 적어도 각 하위 집합의 이름을 특정 이름으로 지정하고 다른 폴더에 저장하려면 어떻게 해야 합니까?
스크립팅윈도우Re: 스크립트를 사용하여 하위 집합을 별도의 폴더에 저장하려면 어떻게 해야 합니까?다음은 이를 수행하는 한 가지 방법의 예입니다.
// Open a file and create 2 subsets and then save all 3 files to
// different folders, keeping the files open in the JMP session,
// and with their original name, but naming each subset in their
// folders where they are saved
Names Default To Here( 1 );
// open the Big Class data table.
dt = Open( "$SAMPLE_DATA/big class.jmp" );
// Create subset one with all Males, letting JMP provide the new data table name
dt << select where( :sex == "M" );
dtA = dt << subset( selected columns( 0 ), selected rows( 1 ) );
// Create subset two with all Females, giving JMP the name of the new table
dt << select where( :sex == "F" );
dtB = dt << subset( selected columns( 0 ), selected rows( 1 ), Output Table( "All Females" ) );
// The Save() function automatically changes the name of the data table being saved
// to the name being specified in the file name specified in the Path of the Save()
// function. Therefore to keep the original table the original name, it has to be
// renamed back to the original name.
holdName = dt << get name;
dt << save( "C:/folderA/MyName.jmp" );
dt << set name( holdName );
// Repeat the save for the first subset
holdName = dtA << get name;
dtA << save( "C:/folderB/MyName.jmp" );
dtA << set name( holdName );
// Repeat for the second subset. The name of this subset has been specifically provided
// so the handling of this can be a little different
Data Table( "All Females" ) << save( "C:/folderC/MyName.jmp" );
Data Table( "MyName" ) << set name( "All Females" );
Re: 스크립트를 사용하여 하위 집합을 별도의 폴더에 저장하려면 어떻게 해야 합니까?이외에 @txnelson 의 광범위한 답변, 기능을 살펴보고 싶을 것입니다. 변환파일경로 .이름에서 알 수 있듯이 파일 경로를 변환하는 데 사용할 수 있지만(예: Windows에서 MacOS 형식으로 또는 상대 경로에서 전체 경로로) 파일 이름과 디렉토리 정보를 별도로 유지하면서 파일 경로를 조작할 수 있기 때문에 마음에 듭니다. , 문자열 연결에 대해 걱정할 필요가 없습니다.
예를 들어
projectHomeFolder = FilePathDefinitions:getProjectHome();
path = convertFilePath("Master_Table.jmp",base(projectHomeFolder));Re: 스크립트를 사용하여 하위 집합을 별도의 폴더에 저장하려면 어떻게 해야 합니까?정말 고맙습니다! 이것은 매우 도움이되었습니다