Hi, I'm new to all this and I find it fascinating!!!
I need help to understand something I want to do but I don't know how...
For sure is a very easy thing...
I have 12 CVS files, monthly sales, each one is a month and I want to make a new table called year_2020. In that table, I want to put all the months together.
I don't know how to make a join but they don't share a second key. I don't want to join the information I want all the information in one table if that's passible?
I would guess you want to join them row-wise. In the following example, I stack three data frames with the rbind() function. Does that work for you?
#Invent some data
DF1 <- data.frame(Name = c("A","B","C"), Value = 1:3)
DF2 <- data.frame(Name = c("D","F","H"), Value = 7:9)
DF3 <- data.frame(Name = c("A","F","B"), Value = 11:13)
#Bind the three data frames
AllDat <- rbind(DF1,DF2,DF3)
AllDat
Name Value
1 A 1
2 B 2
3 C 3
4 D 7
5 F 8
6 H 9
7 A 11
8 F 12
9 B 13
I have accomplished to put all the months into years, then I tried to make one data with all the info but I think is too much information because my Rstudio crashed when I did the rbind () for the three years.
So I decided to take some columns away and just keep the ones that I need. So I tried this:
year_2021_Sm <- year_2021 %>%
select(rideable_type, started_at, ended_at, start_station_name, end_station_name, member_casual) %>%
View()
```
But It doesn't create new data it creates a Value with Null in the environment pane...
I have been looking around for how to do it, I tried subset, but it tells me that cannot find the functionyear_2020, which is the data that I'm trying to make smaller.
Also tried data.frame but that one went really bad... hehe
Can you recommend to me how to make new data but with fewer columns?
> fd %>%
+ filter(member_casual == 'member') %>%
+ as_hms(sum(Trip_Time))
Error in `df_cast_opts()`:
! Data frame must have names.
ℹ In file type-data-frame.c at line 683.
ℹ Install the winch package to get additional debugging info the next time you get this error.
ℹ This is an internal error in the rlang package, please report it to the package authors.
Backtrace:
▆
1. ├─fd %>% filter(member_casual == "member") %>% ...
2. ├─hms::as_hms(., sum(Trip_Time))
3. ├─hms:::as_hms.default(., sum(Trip_Time))
4. │ └─vctrs::vec_cast(x, new_hms())
5. │ └─vctrs `<fn>`()
6. │ └─vctrs::vec_default_cast(...)
7. │ └─vctrs:::df_cast_opts(...)
8. └─rlang:::stop_internal_c_lib(...)
9. └─rlang::abort(message, call = call, .internal = TRUE)
Error:
! Arguments in `...` must be used.
✖ Problematic argument:
• ..1 = sum(Trip_Time)
Run `rlang::last_error()` to see where the error occurred.