how to convert datatable into data frame for plot in ggplot2.

Hi @smriti_j, welcome to RStudio Community.

It's hard to offer you specific help by just looking at an error message. It would be ideal if you could provide a reproducible example (reprex). Please read this guide to see how to create one: