I have many dataframe school_skill_score_ff which has three column 'Skill_full_form', '2020', '2021'. I'm trying to create a pipeline for bar graph. My code is here.
school_bar<-school_skill_score_ff%>%
e_chart(Skill_full_form,backgroundColor='#0d1117',center=c('50%','35%'))%>%
e_bar(`2021`,label=list(show=TRUE,color='#fff',position='top'))%>%
e_bar(`2020`,label=list(show=TRUE,color='#fff',position='top'))%>%
#e_tooltip(trigger = "axis")%>%
e_tooltip(trigger = "axis",axisPointer=list(type='shadow'))%>%
#e_title("Skills Score") %>%
e_theme("westeros")%>%
e_toolbox_feature("dataZoom")%>%
e_animation(duration = 2000)%>%
e_hide_grid_lines('x')%>%
e_y_axis(splitLine=list(lineStyle=list(color='#0f375f')),axisLabel=list(fontSize=10,color='#fff',fontWeight='normal'),name='Skill Score',nameLocation='middle',nameGap=30,nameColor='#fff')%>%
e_x_axis(axisLabel=list(rotate=16,fontSize=10,color='#fff',fontWeight='normal'))%>%
#e_axis_labels(x='Skill Name', y = "Skill Score")%>%
e_y_axis(name='Skill Score',nameLocation='middle',nameGap=38,splitLine=list(lineStyle=list(color='#0f375f')))%>%
#e_title("School Skill Score",top='0%',left='45%',textStyle=list(color='#fff'))%>%
e_legend(top='8%',left='46%',textStyle=list(color='#fff'))%>%
#e_title("School Skill Graph",textStyle=list(color='#fff',fontWeight='normal'),left='center',top='5%') %>%
#e_x_axis(axisLabel=list(rotate=17,fontSize=12))%>%
e_grid(show=TRUE,top='4%',width='90%',left='5%')#,name='Skill Names',nameGap=60,nameLocation='middle')
My issue is that I'm fetching the file directly from an excel file and many files doesn't have column '2020'. This generates an error. I want to handle this error automatically such that graph for one column at least appear when 2nd column is absent. I'm using echarts4r library.