기존 Excel 스프레드시트에 회귀 분석 결과를 추가하는 스크립트를 작성하려고 합니다.안녕하세요 - 회귀 분석 결과를 기존 엑셀 파일에 추가하는 jsl 스크립트를 작성하려고 합니다. 현재 스크립트는 엑셀 파일에 쓰지만 스크립트를 여러 번 실행하고 각각의 새 결과를 기존 엑셀 시트에 추가할 수 있기를 원합니다. (현재는 새 결과를 수동으로, 손으로 추가하고 있습니다.) 첨부된 스크립트를 참조하세요.
미리 감사드립니다!
ps 저는 JMP Pro 17을 사용하고 있습니다
자동화 및 스크립팅Re: 회귀 분석 결과를 기존 Excel 스프레드시트에 추가하는 스크립트를 작성하려고 함훌륭하네요. 고맙습니다, 짐!
Re: 회귀 분석 결과를 기존 Excel 스프레드시트에 추가하는 스크립트를 작성하려고 함다음은 마스터 파일에 새 데이터를 연결하는 데 필요한 작업을 명확히 설명하는 예제 스크립트입니다.
names default to here(1);
// Create 2 data tables and save them as excel files
// one will be the master and one will play the role of the new data
dtExample = open("$SAMPLE_DATA/big class.jmp");
theTables =dtExample << Subset(
By( :sex ),
All rows,
Selected columns only( 0 ),
columns( :name, :age, :height, :weight )
);
close( dtExample, nosave );
// Change the names of the first table to Master
theTables[1] << set name("Master");
data table("Master") << bring window to front;
// Add the new columns to the master, like your master file already
// has all of the columns. In this example, I will only add 1 column
data table("Master")<< new column("Ratio", set each value(:height/:weight));
// Wait 5 seconds so you can observe the master table
wait(5);
// save and close the Master table as an excel table
close( data table("Master"), save("$TEMP/master.xlsx"));
// Change the name of the second table to New Data
theTables[2] << set name("New Data");
data table("New Data") << bring to front;
// wait 5 seconds here too, so you can observe the New Data table
wait(5);
// now save and close the New Data table as an excel table
close( data table("New Data"), save("$TEMP/New Data.xlsx"));
// Now that there are a Master and a New Data table that have been
// created we can now illustrate how to read in some new data,
// add the required new columns, save it, then open the master file,
// and concatenate the new data to the master and then save the updated
// master file
// open the new data table. I am using the variable dt as the pointer
// to the file, since that is what you are doing in your script
dt = open("$TEMP/New Data.xlsx");
// Add the new columns (in this example, only 1 column) to the data table
// your syntax is
// new column("ratio", formula(:height/:weight);
// I suggest that you become more precise and point to the specific data table
// by using either
// dt << New Column(......);
// or
// data table("New Data") << New Column( ...... );
data table("New Data") << New Column( "Ratio", formula(:height/:weight));
// Now the data can be saved
// use either
// dt<< save(...........);
// or
// data table("New Data")<< save(................);
dt << save("$TEMP\test1 n=22.xlsx");
// now open the master table
dtMaster = open("$TEMP\master.xlsx");
// concatenate the new data table to the master
dtMaster << concatenate( dt, append to first table(1));
// now save the master
dtMaster << save("$TEMP\master.xlsx");
// uncomment the below code if you want to close the new data and the master tables
// close( dt, nosave );
// close( dtMaster, nosave );
Re: 회귀 분석 결과를 기존 Excel 스프레드시트에 추가하는 스크립트를 작성하려고 함불행히도, 그것은 도움이 되지 않았습니다. 연결 스크립트는 여전히 작동하지 않습니다. (궁금한데, 스크립트가 프로세스를 자동화한다면 스크립트를 실행할 때마다 팝업 창에서 체크 박스를 클릭해야 하는 이유가 무엇인지 잘 모르겠습니다.)
또한 (아마도 연결 스크립트가 작동하지 않는 것과는 관련이 없을 듯) 어떤 이유에서인지 스크립트가 실행하라고 하는 파일 대신 실행 시작 시에 잔재(이제 삭제된 파일)가 열립니다. 왜 그런지 알 수 없습니다.

그런 다음 회귀 분석을 실행하고 실행 결과에 따라 일부 열을 추가한 후...

Re: 회귀 분석 결과를 기존 Excel 스프레드시트에 추가하는 스크립트를 작성하려고 함"첫 번째 테이블에 추가"라는 라벨이 붙은 확인란을 선택해 보세요.
Re: 회귀 분석 결과를 기존 Excel 스프레드시트에 추가하는 스크립트를 작성하려고 함실행 후 열리는 부분입니다. (흥미롭게도, 제 jsl 코드에서 사용하지 않는 잔여 파일 이름(v2n=25....)이 표시됩니다. 확인하고 다시 확인했습니다.) 어떤 경우든, 아래에 표시된 코드는 연결된 행을 생성하지 않습니다.

dt << save("C:\Users\trcampbell\Desktop\MASTER ECOLI\2024\회귀 분석\검증 실행\testtest2 n=258.xls");
///추가 스크립트 추가
Concatenate("C:\Users\trcampbell\Desktop\MASTER ECOLI\2024\회귀 분석\검증 실행\masterfile n=258.xls") ;
//모든 실행의 행(추가)을 포함하는 마스터파일 저장
dt<< save("C:\Users\trcampbell\Desktop\MASTER ECOLI\2024\회귀 분석\검증 실행\masterfile n=258.xls");
어떤 제안이라도 감사히 받겠습니다.
Re: 회귀 분석 결과를 기존 Excel 스프레드시트에 추가하는 스크립트를 작성하려고 함예
Re: 회귀 분석 결과를 기존 Excel 스프레드시트에 추가하는 스크립트를 작성하려고 함고맙습니다, 짐. 분석을 실행하고 테이블을 추가하는 스크립트가 X라는 파일을 생성하는 경우, 연결하기 전에 X를 먼저 저장해야 합니까? 그렇다면 Concatenate 함수 내의 테이블 이름이 모든 실행의 결과를 수신하는 파일입니까(예: Concatenate(masterfile))?
그러니 위의 내용이 맞다면, 저는 이렇게 말하고 싶습니다:
저장 X
연결하다 (마스터파일)
마스터파일 저장
스크립트를 다시 실행하다
제가 올바르게 읽은 건가요?
Re: 회귀 분석 결과를 기존 Excel 스프레드시트에 추가하는 스크립트를 작성하려고 함여러분이 해야 할 일은 데이터 테이블에 새 열을 만든 후, 데이터를 추가할 Excel 테이블을 읽고, 테이블 =>연결을 사용하여 새 테이블을 데이터를 추가할 테이블에 추가한 다음, 새로 연결된 테이블을 저장하는 것입니다.