2012-02-12 3 views
3

도움말 파일의 '참조'섹션에서 함수 이름을 추출하는 방법은 무엇입니까? 예를 들어 : 객체 = 도움말 (LM) 에서 "참조"섹션 :R에서 도움말 파일의 '참조'섹션에서 함수 이름을 추출하는 방법은 무엇입니까?

‘summary.lm’ for summaries and ‘anova.lm’ for the ANOVA table; 
‘aov’ for a different interface. 

The generic functions ‘coef’, ‘effects’, ‘residuals’, ‘fitted’, 
‘vcov’. 

‘predict.lm’ (via ‘predict’) for prediction, including confidence 
and prediction intervals; ‘confint’ for confidence intervals of 
_parameters_. 

I 함수 이름의 벡터 싶은 - "summary.lm", "anova.lm"를, "coef"...

+1

관련 질문 : http://stackoverflow.com/questions/7493843/how-to-write-contents-of-help-to-a -file-within-r –

+2

아마도 [이 질문] (http://stackoverflow.com/questions/9192589/how-can-i-extract-text-from-rs-help-command)을 사용할 수 있습니다. 도움말 파일을 문자열로 추출한 다음,'See Also'와 그 다음 섹션 제목 사이의 줄에'grep '을 붙이며, 그 재미있는 진드기에 둘러싸인 이름들과 일치합니다. –

답변

-1

나는 이것이 당신이 원하는 것이라고 생각합니다. summary(model.name) 주위도 이름을 모델명 주위에 names 기능을 사용하여 :

mod <- lm(hp ~ mpg, data=mtcars) 
names(mod) 
names(summary(mod)) 
names(mod)[5] #extract just one name from the vector of names with indexing 
+2

I _think_ OP는 R 객체의 names 속성에 액세스하지 않고 실제 도움말 파일에서 관련 함수의 이름을 긁어내는 것을 말하는 것입니다. – joran

관련 문제