我得到了这些数据:
> str(gaDataExt)
Classes ‘tbl_df’, ‘tbl’ and 'data.frame': 2 obs. of 5 variables:
$ date : POSIXct, format: "2016-05-24" "2016-05-31"
$ deviceCategory: chr "desktop" "desktop"
$ users : int 1 2
$ sessions : int 1 2
$ pageviews : int 11 85
- attr(*, "profileInfo")=List of 6
..$ profileId : chr "25439551"
..$ accountId : chr "12543305"
..$ webPropertyId : chr "UA-12543305-1"
..$ internalWebPropertyId: chr "26790206"
..$ profileName : chr "www.ciao.ch"
..$ tableId : chr "ga:25439551"
- attr(*, "query")=List of 8
..$ start.date : chr "30daysAgo"
..$ end.date : chr "yesterday"
..$ profileId : chr "ga:25439551"
..$ dimensions : chr "ga:date,ga:deviceCategory"
..$ metrics : chr "ga:users" "ga:sessions" "ga:pageviews"
..$ segment : chr "sessions::condition::ga:pagePath=@/f /relations /questions_reponses-best_of/;sessions::condition::ga:pagePath=@/f/manger-bouger/q"| __truncated__
..$ start.index: int 1
..$ max.results: int 10000
- attr(*, "sampled")= logi FALSE
我想用ggplot2作图,但是我无法访问$ segment中的数据?
是否可以转换为数据框?
最佳答案
df = as.data.frame(gaDataExt)
就那么简单。
关于r - 使用R将类 ‘tbl_df’, ‘tbl’和'data.frame转换为dataframe,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37594411/