I was using inner_join function to combine two objects. Code look something like this
combined <- inner_join(weekly,nifty.curr.weekly) %>% as.data.frame()
I got the following error
combined <- inner_join(weekly,nifty.curr.weekly) %>% as.data.frame()
Joining, by = "date"
Error in inner_join_impl(x, y, by$x, by$y, suffix$x, suffix$y, check_na_matches(na_matches)) :
unknown group column 'year'
I tried this
weekly$year <- NULL
But it didn't worked.
str(weekly)
gives me something like this
'data.frame': 1249557 obs. of 4 variables:
$ date : Date, format: "2008-10-10" "2008-10-17" ...
$ co_code : int 11 11 11 11 11 11 11 11 11 11 ...
$ company_name : chr "20 MICRONS LTD." "20 MICRONS LTD." "20 MICRONS LTD." "20 MICRONS LTD." ...
$ weeklyreturns: num -0.3718 -0.0509 -0.3021 0.0568 0.1823 ...
- attr(*, "vars")= chr "co_code" "company_name" "year"
- attr(*, "drop")= logi TRUE
Clearly there is "year" but head(weekly)
shows me no column as year. I am fairly new to R. Help me out.
dput(head(weekly))
output is
structure(list(date = structure(c(14162, 14169, 14176, 14183,
14190, 14197), class = "Date"), co_code = c(11L, 11L, 11L, 11L,
11L, 11L), company_name = c("20 MICRONS LTD.", "20 MICRONS LTD.",
"20 MICRONS LTD.", "20 MICRONS LTD.", "20 MICRONS LTD.", "20 MICRONS LTD."
), weeklyreturns = c(-0.371829432619424, -0.0508551219831974,
-0.302077648370433, 0.0567530464383245, 0.182326044668884, -0.123195412632735
)), vars = c("co_code", "company_name", "year"), drop = TRUE, .Names = c("date",
"co_code", "company_name", "weeklyreturns"), row.names = c(NA,
6L), class = "data.frame")
dput(head(nifty.curr.weekly))
output is
structure(list(date = structure(c(10963, 10970, 10977, 10984,
10991, 10998), class = "Date"), niftyreturns = c(1.31650630176203,
0.584047024147951, -0.132578988695284, -1.33554800612288, 0.0406396054173438,
9.31911281754924), currencyreturns = c(NA, 0.0345117017291674,
0.137835997012159, 0.0917622932404161, 0, 0.011490168178474)), .Names = c("date",
"niftyreturns", "currencyreturns"), row.names = c(NA, 6L), class = "data.frame")