akshata nalavadi
akshata nalavadi

Reputation: 1

How to import a dynamodb table attribute into a dataframe in R and plot the dataframe using ggplot

I am trying to import dynamodb in R using paws.database library. I am successful in retrieving the required attribute into R(using scan operation). However the imported data is in the form of a nested list i.e. in [[]] form. My intention is to format the imported dynamodb attribute into a dataframe and later be able to plot it using ggpplot. I have tried using options such as

so far and was unable to convert the data in a proper dataframe format. The final error I get in ggplot is " Error: data must be a data frame, or other object coercible by fortify(), not a list "

Could anyone please help ?

Upvotes: 0

Views: 161

Answers (1)

MikeP
MikeP

Reputation: 1

See this similar issue.

I'm also using paws. Here's what I did to work with a small DynamoDB table:

dyna <- paws::dynamodb()

Table<-dyna$scan("table_name")

newtable<-rbindlist(Table$Items,fill = TRUE)

Then I create a new dataframe by using unlist() on each column of newtable.

Upvotes: 0

Related Questions