Plot NYC Citi Bike Data, Lat and Long Not Displayed on Map - r

I'm trying to plot the NYC citi bike station data on top of a map of NYC.
I downloaded zipcode data from here:
Here is what I've done:
> bike.loc<-bike.train
> nyc.zip<-readShapePoly("nyc_zipcta.shp")
> coordinates(bike.loc)<-c("start.station.id","end.station.id")
> class(bike.loc)
[1] "SpatialPointsDataFrame"
attr(,"package")
[1] "sp"
> str(bike.loc)
Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots
..# data :'data.frame': 150000 obs. of 15 variables:
.. ..$ tripduration : int [1:150000] 970 711 549 883 88 535 975 307 218 542 ...
.. ..$ starttime : Factor w/ 41673 levels "7/1/13 0:00",..: 8738 12152 27602 11984 9651 21822 24531 13946 17666 20150 ...
.. ..$ stoptime : Factor w/ 41752 levels "7/1/13 0:04",..: 8774 12769 27646 12006 9647 21866 24585 13961 17689 18964 ...
.. ..$ start.station.name : Factor w/ 329 levels "1 Ave & E 15 St",..: 9 277 298 321 267 329 71 197 266 182 ...
.. ..$ start.station.latitude : num [1:150000] 40.7 40.7 40.8 40.7 40.7 ...
.. ..$ start.station.longitude: num [1:150000] -74 -74 -74 -74 -74 ...
.. ..$ end.station.name : Factor w/ 329 levels "1 Ave & E 15 St",..: 193 124 6 159 267 73 76 73 116 227 ...
.. ..$ end.station.latitude : num [1:150000] 40.7 40.7 40.8 40.7 40.7 ...
.. ..$ end.station.longitude : num [1:150000] -74 -74 -74 -74 -74 ...
.. ..$ bikeid : int [1:150000] 15301 17873 17596 15864 19005 17230 15476 19805 18494 18104 ...
.. ..$ usertype : Factor w/ 2 levels "Customer","Subscriber": 2 2 2 2 1 2 1 2 2 2 ...
.. ..$ birth.year : Factor w/ 79 levels "\\N","1899","1900",..: 67 37 70 67 1 55 1 45 73 63 ...
.. ..$ gender : int [1:150000] 1 1 1 2 0 1 0 1 1 1 ...
.. ..$ hour : int [1:150000] 19 1 2 8 12 14 15 17 11 9 ...
.. ..$ day : int [1:150000] 15 18 28 17 16 24 26 19 21 22 ...
..# coords.nrs : int [1:2] 4 8
..# coords : num [1:150000, 1:2] 528 466 495 328 212 430 358 323 482 406 ...
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : NULL
.. .. ..$ : chr [1:2] "start.station.id" "end.station.id"
..# bbox : num [1:2, 1:2] 72 72 3002 3002
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : chr [1:2] "start.station.id" "end.station.id"
.. .. ..$ : chr [1:2] "min" "max"
..# proj4string:Formal class 'CRS' [package "sp"] with 1 slots
.. .. ..# projargs: chr NA
I can produce a plot of NYC
plot(nyc.zip)
But I cannot plot the coordinates on top.
plot(bike.loc, add=T, col= "red", pch=15)
I've tried:
EPSG <- make_EPSG()
NY <- with(EPSG,EPSG[grepl("New York",note) & code==2263,]$prj4)
Based on this post, but haven't got it to work.
How do I get the lat/longs plotted over the map?

Related

Kernel density estimation in R for 6 Dimensional data

This is the frist time to perform KDE in R with data which has more than 5 variables for me for anomaly detection.
As far as I know that KDE is performable for multidimensional data but I couldn't find examples which using more than 5 dimensional data.
I'm using data which have 'age', 'trestbps', 'chol', 'thalach', and 'oldpeak' 5 variables as like below.
'data.frame': 176 obs. of 5 variables:
$ age : int 30 50 50 50 50 60 50 40 50 40 ...
$ trestbps: int 130 130 130 130 130 130 130 130 130 130 ...
$ chol : int 198 245 221 288 205 309 240 243 289 250 ...
$ thalach : int 130 166 164 159 184 131 154 152 124 179 ...
$ oldpeak : num 1.6 2.4 0 0.2 0 1.8 0.6 0 1 0 ...
I performed KDE for those data, with the approach as like below, but I'm not sure it is correct approach, and proper result.
evpts <- do.call(expand.grid, lapply(df3, quantile, prob = c(0.1,.25,.5,.75,.9)))
hat2 <- kde(df3, eval.points = evpts)
> str(hat2)
List of 9
$ x : num [1:176, 1:5] 30 50 50 50 50 60 50 40 50 40 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : chr [1:5] "age" "trestbps" "chol" "thalach" ...
$ eval.points:'data.frame': 3125 obs. of 5 variables:
..$ age : Named num [1:3125] 40 40 50 60 60 40 40 50 60 60 ...
.. ..- attr(*, "names")= chr [1:3125] "10%" "25%" "50%" "75%" ...
..$ trestbps: Named num [1:3125] 108 108 108 108 108 112 112 112 112 112 ...
.. ..- attr(*, "names")= chr [1:3125] "10%" "10%" "10%" "10%" ...
..$ chol : Named num [1:3125] 194 194 194 194 194 194 194 194 194 194 ...
.. ..- attr(*, "names")= chr [1:3125] "10%" "10%" "10%" "10%" ...
..$ thalach : Named num [1:3125] 114 114 114 114 114 ...
.. ..- attr(*, "names")= chr [1:3125] "10%" "10%" "10%" "10%" ...
..$ oldpeak : Named num [1:3125] 0 0 0 0 0 0 0 0 0 0 ...
.. ..- attr(*, "names")= chr [1:3125] "10%" "10%" "10%" "10%" ...
..- attr(*, "out.attrs")=List of 2
.. ..$ dim : Named int [1:5] 5 5 5 5 5
.. .. ..- attr(*, "names")= chr [1:5] "age" "trestbps" "chol" "thalach" ...
.. ..$ dimnames:List of 5
.. .. ..$ age : chr [1:5] "age=40" "age=40" "age=50" "age=60" ...
.. .. ..$ trestbps: chr [1:5] "trestbps=108" "trestbps=112" "trestbps=120" "trestbps=128" ...
.. .. ..$ chol : chr [1:5] "chol=194.00" "chol=211.00" "chol=244.00" "chol=283.75" ...
.. .. ..$ thalach : chr [1:5] "thalach=113.50" "thalach=128.25" "thalach=150.00" "thalach=164.00" ...
.. .. ..$ oldpeak : chr [1:5] "oldpeak=0.0" "oldpeak=0.0" "oldpeak=0.8" "oldpeak=1.8" ...
$ estimate : Named num [1:3125] 5.64e-12 5.64e-12 2.85e-09 7.76e-10 7.76e-10 ...
..- attr(*, "names")= chr [1:3125] "1" "2" "3" "4" ...
$ H : num [1:5, 1:5] 6.972 0.866 5.065 -6.541 0.189 ...
$ gridded : logi FALSE
$ binned : logi FALSE
$ names : chr [1:5] "age" "trestbps" "chol" "thalach" ...
$ w : num [1:176] 1 1 1 1 1 1 1 1 1 1 ...
$ type : chr "kde"
- attr(*, "class")= chr "kde"
If it is not proper approach, could you please help me to get correct approach?
Thank you for your support.

Melt not working when converting from Reshape to Reshape 2

Melt not working when upgrading from Reshape to Reshape 2
I have a large list of values. Here is the summary (lots of columns):
List of 46
$ Date: Date[1:9], format: "2011-03-04" ...
$ 1 : num [1:9] 20278 19493 20587 24679 55708 ...
$ 2 : num [1:9] 24029 25317 25103 28871 79423 ...
$ 3 : num [1:9] 6657 7025 6603 8105 17883 ...
$ 4 : num [1:9] 29684 27555 28956 31504 73638 ...
$ 5 : num [1:9] 9572 8759 9947 11173 22341 ...
$ 6 : num [1:9] 18935 20168 22963 24387 58640 ...
$ 7 : num [1:9] 8299 8297 10484 10211 19277 ...
$ 8 : num [1:9] 14365 13691 13906 17149 38364 ...
$ 9 : num [1:9] 10333 10899 9708 11297 24100 ...
$ 10 : num [1:9] 33647 33455 35327 49031 128927 ...
$ 11 : num [1:9] 15090 16105 16343 18624 53809 ...
$ 12 : num [1:9] 17971 16408 15911 18350 44048 ...
$ 13 : num [1:9] 36820 44024 52026 62491 142186 ...
$ 14 : num [1:9] 27036 33240 39248 53035 148606 ...
$ 15 : num [1:9] 11490 11704 12587 17840 50201 ...
$ 16 : num [1:9] 11016 11768 13711 13323 21258 ...
$ 17 : num [1:9] 19792 18734 20477 30433 66028 ...
$ 18 : num [1:9] 19920 20316 21285 29360 88008 ...
$ 19 : num [1:9] 17046 19281 19610 30376 80302 ...
$ 20 : num [1:9] 32886 38971 44672 53278 141423 ...
$ 21 : num [1:9] 11324 13211 13123 15510 32014 ...
$ 22 : num [1:9] 21416 23530 25978 37096 94035 ...
$ 23 : num [1:9] 29527 33310 32701 42628 112442 ...
$ 24 : num [1:9] 19479 19181 20525 25210 69559 ...
$ 25 : num [1:9] 20727 20620 22190 29052 59528 ...
$ 26 : num [1:9] 16056 15122 15240 17327 39292 ...
$ 27 : num [1:9] 19020 28919 29659 43806 94475 ...
$ 28 : num [1:9] 19041 15803 15940 20319 49065 ...
$ 29 : num [1:9] 15775 15080 17841 21492 49891 ...
$ 30 : num [1:9] 9554 10395 9605 11513 13558 ...
$ 31 : num [1:9] 15322 16603 16348 17228 32973 ...
$ 32 : num [1:9] 19752 21591 21272 24639 52204 ...
$ 33 : num [1:9] 2017 2109 1944 1899 2224 ...
$ 34 : num [1:9] 18797 18496 17514 20066 39702 ...
$ 35 : num [1:9] 14306 13489 14507 18560 51028 ...
$ 36 : num [1:9] 2247 2558 2232 2401 2931 ...
$ 37 : num [1:9] 10971 10779 10272 11788 17386 ...
$ 38 : num [1:9] 6241 6414 6024 6291 8257 ...
$ 39 : num [1:9] 16933 18888 20160 25847 60786 ...
$ 40 : num [1:9] 18254 17638 17956 20265 43778 ...
$ 41 : num [1:9] 18249 19955 20016 25647 53012 ...
$ 42 : num [1:9] 9917 10655 10194 10354 15472 ...
$ 43 : num [1:9] 6561 6903 6941 6174 14034 ...
$ 44 : num [1:9] 5857 5968 6283 7645 9861 ...
$ 45 : num [1:9] 17185 18197 19508 26187 67014 ...
- attr(*, "row.names")= int [1:9] 1 2 3 4 5 6 7 8 9
- attr(*, "idvars")= chr "Date"
- attr(*, "rdimnames")=List of 2
..$ :'data.frame': 9 obs. of 1 variable:
.. ..$ Date: Date[1:9], format: "2011-03-04" ...
..$ :'data.frame': 45 obs. of 1 variable:
.. ..$ Store: num [1:45] 1 2 3 4 5 6 7 8 9 10 ...
'data.frame': 405 obs. of 3 variables:
$ Date : Date, format: "2011-03-04" ...
$ value: num 20278 19493 20587 24679 55708 ...
$ Store: num 1 1 1 1 1 1 1 1 1 2 ...
With the original reshape library I am able to melt it down without issue:
'data.frame': 405 obs. of 3 variables:
$ Date : Date, format: "2011-03-04" ...
$ value: num 20278 19493 20587 24679 55708 ...
$ Store: num 1 1 1 1 1 1 1 1 1 2 ...
However, when I try to use melt from Reshape2, I get the following warning and error:
attributes are not identical across measure variables; they will be dropped
Error: `by` must be supplied when `x` and `y` have no common variables.
What happened here between versions here? Any suggestions for fixing? I'm stuck using Reshape2 for this. Thanks!

prcomp error: "undefined columns selected"

I am trying to build a PCA with a matrix of labeled numeric data. I am trying to select only certain columns (6-78) to include in the PCA, but have an error (syntax?)
Here's the code:
cytokines.pca <- prcomp(PICHCytokines[,c(6:78)], center = TRUE, scale. = TRUE)
summary(cytokines.pca)
The error is:
Error in [.data.frame(data, , c(6:78)) : undefined columns selected
Here's the structure of my data frame:
str(PICHCytokines)
'data.frame': 106 obs. of 69 variables:
$ Record.ID : Factor w/ 106 levels "FA001","FA007",..: 1 2 3 4 5 6 7 8 9 10 ...
..- attr(*, "label")= chr "Record ID"
$ Event.Name : Factor w/ 2 levels "Enrollment and Admission",..: 1 1 1 1 1 1 1 1 1 1 ...
..- attr(*, "label")= chr "Event Name"
$ Time.since.trauma: 'labelled' num 0.717 7.717 1.383 0.817 2.85 ...
..- attr(*, "label")= chr "Time since trauma"
$ Batch.Number : 'labelled' int 1 1 1 1 1 1 1 1 1 1 ...
..- attr(*, "label")= chr "Batch Number"
$ Plate.Number : 'labelled' int 1 1 1 1 1 1 1 1 1 1 ...
..- attr(*, "label")= chr "Plate Number"
$ FASL.MFI : 'labelled' num 748 295 256 333 275 ...
..- attr(*, "label")= chr "FASL MFI"
$ TGFA.MFI : 'labelled' num 122 64.2 96 126 94.8 ...
..- attr(*, "label")= chr "TGFA MFI"
$ MIP1A.MFI : 'labelled' num 1611 142 158 339 168 ...
..- attr(*, "label")= chr "MIP1A MFI"
$ IL27.MFI : 'labelled' num 139.2 40 63 52.5 63.2 ...
..- attr(*, "label")= chr "IL27 MFI"
$ IL1B.MFI : 'labelled' num 68 38.2 77.5 46 70.8 ...
..- attr(*, "label")= chr "IL1B MFI"
$ IL2.MFI : 'labelled' num 159 61.5 120.8 79.5 117.2 ...
..- attr(*, "label")= chr "IL2 MFI"

How Can I Quickly Inspect Built-in Data Sets (PSA)?

One of the best ways to make a question reproducible is to use one of the built in data sets. Using data(), however, is frustrating because no information about the structure of the data set is provided.
How can I quickly view the structure of available data sets?
The following function may help:
dataStr <- function(fun=function(x) TRUE)
str(
Filter(
fun,
Filter(
Negate(is.null),
mget(data()$results[, "Item"], inh=T, ifn=list(NULL))
) ) )
It accepts a filtering function, applies it to all the data sets, and prints out the structure of the matching data sets. For example, if we're looking for matrices:
> dataStr(is.matrix)
List of 8
$ WorldPhones : num [1:7, 1:7] 45939 60423 64721 68484 71799 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : chr [1:7] "1951" "1956" "1957" "1958" ...
.. ..$ : chr [1:7] "N.Amer" "Europe" "Asia" "S.Amer" ...
$ occupationalStatus : 'table' int [1:8, 1:8] 50 16 12 11 2 12 0 0 19 40 ...
..- attr(*, "dimnames")=List of 2
.. ..$ origin : chr [1:8] "1" "2" "3" "4" ...
.. ..$ destination: chr [1:8] "1" "2" "3" "4" ...
$ volcano : num [1:87, 1:61] 100 101 102 103 104 105 105 106 107 108 ...
--- 5 entries omitted ---
Or for data frames (also omitting entries):
> dataStr(is.data.frame)
List of 42
$ BOD :'data.frame': 6 obs. of 2 variables:
..$ Time : num [1:6] 1 2 3 4 5 7
..$ demand: num [1:6] 8.3 10.3 19 16 15.6 19.8
..- attr(*, "reference")= chr "A1.4, p. 270"
$ CO2 :Classes ‘nfnGroupedData’, ‘nfGroupedData’, ‘groupedData’ and 'data.frame': 84 obs. of 5 variables:
..$ Plant : Ord.factor w/ 12 levels "Qn1"<"Qn2"<"Qn3"<..: 1 1 1 1 1 1 1 2 2 2 ...
..$ Type : Factor w/ 2 levels "Quebec","Mississippi": 1 1 1 1 1 1 1 1 1 1 ...
..$ Treatment: Factor w/ 2 levels "nonchilled","chilled": 1 1 1 1 1 1 1 1 1 1 ...
..$ conc : num [1:84] 95 175 250 350 500 675 1000 95 175 250 ...
..$ uptake : num [1:84] 16 30.4 34.8 37.2 35.3 39.2 39.7 13.6 27.3 37.1 ...
--- 40 entries omitted ---
Or even for simple vectors:
> dataStr(function(x) is.atomic(x) && is.vector(x) && !is.ts(x))
List of 4
$ euro : Named num [1:11] 13.76 40.34 1.96 166.39 5.95 ...
..- attr(*, "names")= chr [1:11] "ATS" "BEF" "DEM" "ESP" ...
$ islands: Named num [1:48] 11506 5500 16988 2968 16 ...
..- attr(*, "names")= chr [1:48] "Africa" "Antarctica" "Asia" "Australia" ...
$ precip : Named num [1:70] 67 54.7 7 48.5 14 17.2 20.7 13 43.4 40.2 ...
..- attr(*, "names")= chr [1:70] "Mobile" "Juneau" "Phoenix" "Little Rock" ...
$ rivers : num [1:141] 735 320 325 392 524 ...

Extract elements of multiple sublists in a list and transform to multiple dataframes

Hello Dear Community,
Following this post,
I am searching how to create multiple data frames from a list that contains multiple sublists with different names
So, from a list called tier.col I would like to create a function tier2col that returns to multiple data.frames (as much as there is sublist in my list) containing specific elements of the sublist.
I get how to do this manually as so :
phones <- data.frame(tier.col$phones$xmin[-1,3], tier.col$phones$xmax[-1,3], tier.col$phones$text[3])
But in reality "phones" changes in multiple names, so I would need a more generic approach to sublists:
x <- data.frame(tier.col$x$xmin[-1,3], tier.col$x$xmax[-1,3], tier.col$x$text[3])
The function would act as so :
tier2col <- function(list.x) {
for all sublist in my list
select tier.col$sublist$xmin[-1,3], tier.col$sublist$xmax[-1,3], tier.col$sublist$text[3]
and compile them in a dataframe
}
I know that I can call all the xmin & xmax & text by this :
lapply(tier.col[c(1:length(names(tier.col)))], "[", 1)
lapply(tier.col[c(1:length(names(tier.col)))], "[", 2)
lapply(tier.col[c(1:length(names(tier.col)))], "[", 3)
But I don't know how to get pass this or how to use mapply on this kind of datastructure.
I would have like something like tier.col$c(names(tier.col)$xmin to work, but evidently, that is not the proper way to do it.
Can someone help me to compute this in an efficient way?
Stucture of tier.col:
List of 17
$ phones :List of 3
..$ xmin:'data.frame': 2506 obs. of 3 variables:
.. ..$ num.row: num [1:2506] 11 15 19 23 27 31 35 39 43 47 ...
.. ..$ object : chr [1:2506] "xmin" "xmin" "xmin" "xmin" ...
.. ..$ value : Factor w/ 4466 levels ""," "," n ",..: 20 20 21 22 23 24 26 27 28 29 ...
..$ xmax:'data.frame': 2506 obs. of 3 variables:
.. ..$ num.row: num [1:2506] 12 16 20 24 28 32 36 40 44 48 ...
.. ..$ object : chr [1:2506] "xmax" "xmax" "xmax" "xmax" ...
.. ..$ value : Factor w/ 4466 levels ""," "," n ",..: 2414 21 22 23 24 26 27 28 29 30 ...
..$ text:'data.frame': 2505 obs. of 3 variables:
.. ..$ num.row: num [1:2505] 17 21 25 29 33 37 41 45 49 53 ...
.. ..$ object : chr [1:2505] "text" "text" "text" "text" ...
.. ..$ value : Factor w/ 4466 levels ""," "," n ",..: 11 4397 4434 3697 4025 3697 3832 4127 3992 4397 ...
$ syll :List of 3
..$ xmin:'data.frame': 1147 obs. of 3 variables:
.. ..$ num.row: num [1:1147] 10037 10041 10045 10049 10053 ...
.. ..$ object : chr [1:1147] "xmin" "xmin" "xmin" "xmin" ...
.. ..$ value : Factor w/ 4466 levels ""," "," n ",..: 20 20 21 24 27 30 33 35 37 40 ...
..$ xmax:'data.frame': 1147 obs. of 3 variables:
.. ..$ num.row: num [1:1147] 10038 10042 10046 10050 10054 ...
.. ..$ object : chr [1:1147] "xmax" "xmax" "xmax" "xmax" ...
.. ..$ value : Factor w/ 4466 levels ""," "," n ",..: 2414 21 24 27 30 33 35 37 40 43 ...
..$ text:'data.frame': 1146 obs. of 3 variables:
.. ..$ num.row: num [1:1146] 10043 10047 10051 10055 10059 ...
.. ..$ object : chr [1:1146] "text" "text" "text" "text" ...
.. ..$ value : Factor w/ 4466 levels ""," "," n ",..: 11 4431 4028 3879 4430 4442 4405 3783 4159 4327 ...
$ delivery :List of 3
..$ xmin:'data.frame': 1147 obs. of 3 variables:
.. ..$ num.row: num [1:1147] 14627 14631 14635 14639 14643 ...
.. ..$ object : chr [1:1147] "xmin" "xmin" "xmin" "xmin" ...
.. ..$ value : Factor w/ 4466 levels ""," "," n ",..: 20 20 21 24 27 30 33 35 37 40 ...
..$ xmax:'data.frame': 1147 obs. of 3 variables:
.. ..$ num.row: num [1:1147] 14628 14632 14636 14640 14644 ...
.. ..$ object : chr [1:1147] "xmax" "xmax" "xmax" "xmax" ...
.. ..$ value : Factor w/ 4466 levels ""," "," n ",..: 2414 21 24 27 30 33 35 37 40 43 ...
..$ text:'data.frame': 1146 obs. of 3 variables:
.. ..$ num.row: num [1:1146] 14633 14637 14641 14645 14649 ...
.. ..$ object : chr [1:1146] "text" "text" "text" "text" ...
.. ..$ value : Factor w/ 4466 levels ""," "," n ",..: 11 2 2 2 2 2 2 2 2 2 ...
$ link :List of 3
..$ xmin:'data.frame': 807 obs. of 3 variables:
.. ..$ num.row: num [1:807] 19217 19221 19225 19229 19233 ...
.. ..$ object : chr [1:807] "xmin" "xmin" "xmin" "xmin" ...
.. ..$ value : Factor w/ 4466 levels ""," "," n ",..: 20 20 21 27 30 34 37 40 45 1642 ...
..$ xmax:'data.frame': 807 obs. of 3 variables:
.. ..$ num.row: num [1:807] 19218 19222 19226 19230 19234 ...
.. ..$ object : chr [1:807] "xmax" "xmax" "xmax" "xmax" ...
.. ..$ value : Factor w/ 4466 levels ""," "," n ",..: 2414 21 27 30 34 37 40 45 1642 1651 ...
..$ text:'data.frame': 806 obs. of 3 variables:
.. ..$ num.row: num [1:806] 19223 19227 19231 19235 19239 ...
.. ..$ object : chr [1:806] "text" "text" "text" "text" ...
.. ..$ value : Factor w/ 4466 levels ""," "," n ",..: 11 2 2 4025 2 2 2 4025 2 4025 ...
$ words :List of 3
..$ xmin:'data.frame': 807 obs. of 3 variables:
.. ..$ num.row: num [1:807] 22447 22451 22455 22459 22463 ...
.. ..$ object : chr [1:807] "xmin" "xmin" "xmin" "xmin" ...
.. ..$ value : Factor w/ 4466 levels ""," "," n ",..: 20 20 21 27 30 34 37 40 45 1642 ...
..$ xmax:'data.frame': 807 obs. of 3 variables:
.. ..$ num.row: num [1:807] 22448 22452 22456 22460 22464 ...
.. ..$ object : chr [1:807] "xmax" "xmax" "xmax" "xmax" ...
.. ..$ value : Factor w/ 4466 levels ""," "," n ",..: 2414 21 27 30 34 37 40 45 1642 1651 ...
..$ text:'data.frame': 806 obs. of 3 variables:
.. ..$ num.row: num [1:806] 22453 22457 22461 22465 22469 ...
.. ..$ object : chr [1:806] "text" "text" "text" "text" ...
.. ..$ value : Factor w/ 4466 levels ""," "," n ",..: 11 4424 3881 4429 3745 3781 4160 4054 3983 4229 ...
Don't hesitate to tell if something is not clear/missing,
Thanks a lot,
If you know how to process one item (phones), then just generalize that into a function so you can run it to the whole list via lapply:
process.one <- function(x)
data.frame(xmin = x$xmin[-1,3], xmax = x$xmax[-1,3], text = x$text[3])
out <- lapply(tier.col, process.one)
At this point, out is a list of data.frames. It is recommended you keep it that way, but if what you really wanted are data.frames to be added to an environment (e.g. the global environment) then you can do so with list2env:
list2env(out, envir = .GlobalEnv)

Resources