로그인 바로가기 하위 메뉴 바로가기 본문 바로가기

R언어를 활용한 기초컴퓨터프로그래밍

박성호 부산대학교
http://www.edwith.org/pnu-basicr/forum/6010
좋아요 185 수강생 5898

number <- seq(1:4)
name <- c("mary","tom","jackson","rilly")
kor <- c(80,60,90,70)
eng <- c(70,50,100,80)
mat <- c(95,70,95,80)
grade <-c("B","D","A","C")
stuInfo <- data.frame(번호=number,이름=name,국어=kor,
영어=eng, 수학=mat, 성적=grade, stringsAsFactors = FALSE)
res1 <- stuInfo$이름; print(res1)
#태그 이름"$이름"으로 name행에 접근
res2 <- stuInfo[[2]];print(res2)


이 예제에서 왜 res2에 stuInfo[[2]]를 집어 넣나요???

그리고 stuInfo[2]를 하면 class가 data.frame이고

 stuInfo[[2]]를 하면 class가 character인지 알고 싶습니다.!