Difference between revisions of "R: tidytext NASA data"
Jump to navigation
Jump to search
Onnowpurbo (talk | contribs) (Created page with " library(jsonlite) metadata <- fromJSON("https://data.nasa.gov/data.json") names(metadata$dataset) class(metadata$dataset$title) class(metadata$dataset$description) cla...") |
Onnowpurbo (talk | contribs) |
||
Line 8: | Line 8: | ||
class(metadata$dataset$keyword) | class(metadata$dataset$keyword) | ||
+ | # ambil judul2 | ||
library(dplyr) | library(dplyr) | ||
nasa_title <- data_frame(id = metadata$dataset$`_id`$`$oid`, | nasa_title <- data_frame(id = metadata$dataset$`_id`$`$oid`, | ||
Line 14: | Line 15: | ||
− | + | # sampling 5 line | |
+ | nasa_desc <- data_frame(id = metadata$dataset$`_id`$`$oid`, | ||
+ | desc = metadata$dataset$description) | ||
+ | nasa_desc %>% | ||
+ | select(desc) %>% | ||
+ | sample_n(5) | ||
Revision as of 08:03, 8 November 2018
library(jsonlite) metadata <- fromJSON("https://data.nasa.gov/data.json") names(metadata$dataset)
class(metadata$dataset$title) class(metadata$dataset$description) class(metadata$dataset$keyword)
# ambil judul2 library(dplyr) nasa_title <- data_frame(id = metadata$dataset$`_id`$`$oid`, title = metadata$dataset$title) nasa_title
# sampling 5 line nasa_desc <- data_frame(id = metadata$dataset$`_id`$`$oid`, desc = metadata$dataset$description) nasa_desc %>% select(desc) %>% sample_n(5)