0

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

  • df <- ldply (list_a, data.frame), ldply (list_a, data.frame),
  • data.frame(matrix(unlist(list_a), nrow=length(list_a), byrow=TRUE),stringsAsFactors=FALSE),
  • as.data.frame(do.call(cbind,list_a))

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 ?

1 Answers1

0

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.

MikeP
  • 1
  • 1