Larousse24 / Larousse24-ag-problems-semester

Summer 2020/Data Carpentry for Agroecologists
0 stars 0 forks source link

Assignment #6 #6

Closed Larousse24 closed 4 years ago

Larousse24 commented 4 years ago

@brymz, I am trying to have a new data after filtering so that I can produce a graphic, but it doesn't work. Here is my codes,
Dry_Biomass_RAW_2019_Winter_TREC %>% select(Seasons, Croptrt, LeavesStemsFresh_tha, LeavesStemsDry_tha) %>% filter(Croptrt == "SHSS") %>% mutate(watercontent = LeavesStemsFresh_tha-LeavesStemsDry_tha) %>%

Those two pieces of code below do not work, so I can't have the data that I need for the graphic. new data <-filter(Croptrt == "SHSS") %>% or newdata<-mutate(watercontent = LeavesStemsFresh_tha-LeavesStemsDry_tha) What should I do?

brymz commented 4 years ago

The %>% pipe connects multiple lines of code so they act as a single code chunk. The code breaks if you insert something in between. Some options:

new_data <- Dry_Biomass_RAW_2019_Winter_TREC %>%
   select(Seasons, Croptrt, LeavesStemsFresh_tha, LeavesStemsDry_tha) %>%
   filter(Croptrt == "SHSS") %>%
   mutate(watercontent = LeavesStemsFresh_tha-LeavesStemsDry_tha)

newer_data <- filter(new_data, Croptrt == "SHSS") newer_data <- mutate(new_data, watercontent = LeavesStemsFresh_tha-LeavesStemsDry_tha)

Larousse24 commented 4 years ago

@brymz , I still cannot produce the graphics even though I've tried removing the pipe and using different datasets. I am going to upload the codes that I've been using in my lists of codes so that you could give them a look for me.

Larousse24 commented 4 years ago

@brymz ,I am done with assignment 6 and 7. I've already uploaded the codes in the update list.