R- 패키지의 하위 집합 연산자 ::
의 시작 및 끝 값으로 사용자 초기화 된 날짜 변수를 어떻게 적용합니까?부분 집합 연산자 사용 ::: quantmod에서 변수 사용
, 나는 사용자 초기화 날짜 변수를 적용,
end.date <- Sys.Date()
start.date <- end.date - 5*365 #5- years to-date
start.date.char <- as.character(start.date)
end.date.char <- as.character(end.date)
주식 데이터의 5 년을 얻을 수
library(quantmod)
getSymbols("GILD",src="yahoo")
GILD.5YTD <- GILD['start.date.char::end.date.char']
나는 다음과 같은 오류 얻을 :
Error in if (length(c(year, month, day, hour, min, sec))
== 6 && c(year, :
missing value where TRUE/FALSE needed
을 경고 메시지 :
1: In as_numeric(YYYY) : NAs introduced by coercion
2: In as_numeric(MM) : NAs introduced by coercion
3: In as_numeric(DD) : NAs introduced by coercion
4: In as_numeric(YYYY) : NAs introduced by coercion
5: In as_numeric(MM) : NAs introduced by coercion
6: In as_numeric(DD) : NAs introduced by coercion
이 질문이 기본적인 질문이지만 저는 초보자입니다.
읽기 ' ". XTS"'당신은 아마'GILD [붙여 넣기 (start.date.char, end.date.char 9 월을 찾고 수 = "/")]'? –
이것은 일을합니다. 감사합니다 – Cam