R 표준 출력을 얻는 방법JSL을 통해 R 코드를 제출하면 R 콘솔 표준 출력(stdout)이 JMP 로그에 표시됩니다.해당 정보를 텍스트 문자열로 캡처하는 방법이 있습니까?stdout을 R에서 파일로 리디렉션(sink() 함수 사용)한 다음 일부 JSL을 사용하여 JMP 변수의 파일 내용을 가져올 수 있다는 것을 알고 있지만 그런 중간 단계를 사용할 필요가 없습니다.
예시;
names default to here(1);
R Init();
dt=open("$SAMPLE_DATA/Cars.jmp");
R Send(dt);
R Submit(
"
summary(lm(formula=Chest.decel ~ Wt, data=dt))
"
);
RTerm();이 출력은 로그 파일에 표시됩니다.
Call:
lm(formula = Chest.decel ~ Wt, data = dt)
Residuals:
Min 1Q Median 3Q Max
-17.931 -6.650 -1.482 5.593 44.232
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.853e+01 2.440e+00 15.792 < 2e-16 ***
Wt 3.354e-03 8.135e-04 4.123 4.7e-05 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 9.367 on 339 degrees of freedom
(11 observations deleted due to missingness)
Multiple R-squared: 0.04776, Adjusted R-squared: 0.04495
F-statistic: 17 on 1 and 339 DF, p-value: 4.703e-05출력을 텍스트 문자열로 가져와 보고서 창의 텍스트 상자에 넣을 수 있기를 원합니다.
Re: R 표준 출력을 얻는 방법로그 캡처() 당신이 원하는 것을 할 수 있습니다.
Names Default To Here(1);
R Init();
dt = Open("$SAMPLE_DATA/Cars.jmp");
R Send(dt);
R_stdout = Log Capture(R Submit("
summary(lm(formula=Chest.decel ~ Wt, data=dt))
"));
R Term();
New Window("example", Text Box(R_stdout));Re: R 표준 출력을 얻는 방법제안해 주셔서 감사합니다.R 결과를 R 데이터 개체에 넣을 수 있는지 알고 R Get()을 사용하여 결과를 검색할 수 있습니다.그러나 적어도 내 목적을 위해 stdout 결과를 텍스트 문자열로 얻는 것이 훨씬 쉬울 것입니다.
@uday_guntupalli 썼다:
@MathStatChem ,
이 시도:
R Init();
dt=open("$SAMPLE_DATA/Cars.jmp");
R Send(dt);
R Submit(
"
model = lm(Chest.decel ~ Wt,data = dt)
t = summary(model)
# Use names function to determine what are the objects that exist
names(t)
# Extract and cast into data frames
Residuals = as.data.frame(t$residuals)
Coefficients = as.data.frame(t$coefficients)
"
);
ResidJMP = R Get(Residuals);
ResidJMP << New Data View;
CoeffJMP = R Get(Coefficients);
CoeffJMP << New Data View;
RTerm();
Close(dt,"No Save");
Re: R 표준 출력을 얻는 방법@MathStatChem ,
이 시도:
R Init();
dt=open("$SAMPLE_DATA/Cars.jmp");
R Send(dt);
R Submit(
"
model = lm(Chest.decel ~ Wt,data = dt)
t = summary(model)
# Use names function to determine what are the objects that exist
names(t)
# Extract and cast into data frames
Residuals = as.data.frame(t$residuals)
Coefficients = as.data.frame(t$coefficients)
"
);
ResidJMP = R Get(Residuals);
ResidJMP << New Data View;
CoeffJMP = R Get(Coefficients);
CoeffJMP << New Data View;
RTerm();
Close(dt,"No Save");
Re: R 표준 출력을 얻는 방법내가 볼 수 있듯이 R Get()은 R 데이터 구조 또는 변수(숫자, 문자열, 행렬, 목록 또는 데이터 프레임)에서 값을 가져오지만 표준 출력은 가져오지 않습니다.
Re: R 표준 출력을 얻는 방법@MathStatChem ,
너무 앞서 가기 전에 R Get() 을 사용하고 싶지 않습니까? R Get()을 사용한 다음 해당 정보를 텍스트 상자에 대한 입력으로 사용해 보셨습니까?