Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
25 lines (23 loc) · 818 Bytes

File metadata and controls

25 lines (23 loc) · 818 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
library(rjson)
library(blsAPI)
response <- blsAPI('CIU1010000000000A')
response
json <-fromJSON(response)
json
## Process results
df <- data.frame(year=character(),
period=character(),
periodName=character(),
value=character(),
stringsAsFactors=FALSE)
i <- 0
# the 0 gives the starting position of the data frame
# i, a commonly-used variable in for loops that stands for index
for(d in json$Results$series[[1]]$data){
i <- i + 3 # this deals with row positioning
df[i,] <- unlist(d)
}
# the "d" could be anything. try changign the ds to es for example
# unlist(x)
# Unlist a list of vectors into a single vector. This function will also unlist all lists within the list as well, but this setting may be turned off via additional options.
df
Morty Proxy This is a proxified and sanitized view of the page, visit original site.