-1

I am very new to R, and what I am trying to achieve is that I have a dataset in CSV format stored in mongodb. I have already linked Rstudio and mongodb and the data is successfully imported in Rstudio. Now, I want to do some visualization of the data. I want to make some bar graphs, piecharts, heatmaps etc. But all the tutorials that I have seen they use dataframes in ggplot. How do I convert the imported data from CSV file to a dataframe? I know I might sound stupid but Im a beginner, any help would be appreciated. The dataset that im using is the 2017 CSV file from this link: https://www1.nyc.gov/site/nypd/stats/reports-analysis/stopfrisk.page

  • Welcome to StackOverflow.com. please first read about [How to make a great R reproducible example?](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) to have better experience with your question about R. – SirSaleh Sep 15 '18 at 08:21

1 Answers1

0

What is the structure of the "csv" you've imported from the database? You could try converting it to a data.frame using as.data.frame. If class(x) has more than one class, e.g. tibble and data.frame, a method will use the class which it is designed to use. If your object is of class e.g. tibble and data.frame, ggplot will know how to handle that.

Roman Luštrik
  • 69,533
  • 24
  • 154
  • 197