2012-08-29 3 views
1

가능한 중복 :
Identify all objects of given class for further processing만 목록 객체

나는 내 작업 공간에있는 모든 데이터 프레임의 인덱스를 구축하고자합니다. 어떻게 같은 소리가 뭔가를 쓰기 않습니다 코멘트에서 제공하는 링크 @Chase을 바탕으로

dindex <- ls(class=data.frame) 
+0

당신이 본 ['.ls.objects'] (http://stackoverflow.com/questions/1358003/tricks-to-manage-the-available-memory-in-an-r-session) ? – GSee

+0

고마워, 그게 내가 찾고 있었던거야! – dmvianna

+0

이 질문과 관련이 있습니다 : http://stackoverflow.com/questions/5158830/identify-all-objects-of-given-class-for-further-processing – Chase

답변

4

, 당신은 단지 data.frame 클래스를 inherit 객체의 이름을 포함에 ls의 결과를 Filter 수 있습니다.

#R --vanilla -q 
a <- data.frame(1:3) 
b <- data.frame(1:2, 4:3) 
L <- list(a, b) 
Filter(function(x) inherits(get(x), "data.frame"), ls()) 
#[1] "a" "b" 
+0

위대하고 유용한 답변! –