I have data look like
structure(list(`_id` = c(2653L, 2729L, 2920L, 2921L, 2922L, 2923L
), name = c("RunningApplicationsProbe", "RunningApplicationsProbe",
"RunningApplicationsProbe", "RunningApplicationsProbe", "RunningApplicationsProbe",
"RunningApplicationsProbe"), timestamp = c(1404116791.097, 1404116803.554,
1404116805.61, 1404116814.795, 1404116830.116, 1404116868.244
), value = c("{\"duration\":12.401,\"taskInfo\":{\"baseIntent\":{\"mAction\":\"android.intent.action.MAIN\",\"mCategories\":[\"android.intent.category.LAUNCHER\"],\"mComponent\":{\"mClass\":\"kr.ac.jnu.netsys.MainActivity\",\"mPackage\":\"edu.mit.media.funf.wifiscanner\"},\"mFlags\":268435456,\"mPackage\":\"edu.mit.media.funf.wifiscanner\",\"mWindowMode\":0},\"id\":102,\"persistentId\":102},\"timestamp\":1404116791.097}",
"{\"duration\":2.055,\"taskInfo\":{\"baseIntent\":{\"mAction\":\"android.intent.action.MAIN\",\"mCategories\":[\"android.intent.category.LAUNCHER\"],\"mComponent\":{\"mClass\":\"com.nhn.android.search.ui.pages.SearchHomePage\",\"mPackage\":\"com.nhn.android.search\"},\"mFlags\":270532608,\"mWindowMode\":0},\"id\":97,\"persistentId\":97},\"timestamp\":1404116803.554}",
"{\"duration\":9.183,\"taskInfo\":{\"baseIntent\":{\"mAction\":\"android.intent.action.MAIN\",\"mCategories\":[\"android.intent.category.HOME\"],\"mComponent\":{\"mClass\":\"com.buzzpia.aqua.launcher.LauncherActivity\",\"mPackage\":\"com.buzzpia.aqua.launcher\"},\"mFlags\":274726912,\"mWindowMode\":0},\"id\":3,\"persistentId\":3},\"timestamp\":1404116805.61}",
"{\"duration\":15.320,\"taskInfo\":{\"baseIntent\":{\"mAction\":\"android.intent.action.MAIN\",\"mCategories\":[\"android.intent.category.LAUNCHER\"],\"mComponent\":{\"mClass\":\"kr.ac.jnu.netsys.MainActivity\",\"mPackage\":\"edu.mit.media.funf.wifiscanner\"},\"mFlags\":270532608,\"mWindowMode\":0},\"id\":103,\"persistentId\":103},\"timestamp\":1404116814.795}",
"{\"duration\":38.126,\"taskInfo\":{\"baseIntent\":{\"mComponent\":{\"mClass\":\"com.rechild.advancedtaskkiller.AdvancedTaskKiller\",\"mPackage\":\"com.rechild.advancedtaskkiller\"},\"mFlags\":71303168,\"mWindowMode\":0},\"id\":104,\"persistentId\":104},\"timestamp\":1404116830.116}",
"{\"duration\":3.015,\"taskInfo\":{\"baseIntent\":{\"mAction\":\"android.intent.action.MAIN\",\"mCategories\":[\"android.intent.category.LAUNCHER\"],\"mComponent\":{\"mClass\":\"kr.ac.jnu.netsys.MainActivity\",\"mPackage\":\"edu.mit.media.funf.wifiscanner\"},\"mFlags\":270532608,\"mWindowMode\":0},\"id\":103,\"persistentId\":103},\"timestamp\":1404116868.244}"
)), .Names = c("_id", "name", "timestamp", "value"), row.names = c(2653L,
2729L, 2920L, 2921L, 2922L, 2923L), class = "data.frame")
This data is about running application log, the data has JSON format. I just confused when I want to get sub value.
I just code like this
myData <- lapply(dRunningApplicationsProbe$value, fromJSON)
The output look like
..$ duration : num 9.18
..$ taskInfo :List of 3
.. ..$ baseIntent :List of 5
.. .. ..$ mAction : chr "android.intent.action.MAIN"
.. .. ..$ mCategories: chr "android.intent.category.HOME"
.. .. ..$ mComponent :List of 2
.. .. .. ..$ mClass : chr "com.buzzpia.aqua.launcher.LauncherActivity"
.. .. .. ..$ mPackage: chr "com.buzzpia.aqua.launcher"
.. .. ..$ mFlags : num 2.75e+08
.. .. ..$ mWindowMode: num 0
.. ..$ id : num 3
.. ..$ persistentId: num 3
..$ timestamp: num 1.4e+09
In this case, it's easy for getting timestamp, and duration value
dRunningApplicationsProbe$time <- do.call(rbind,lapply(myData, `[` ,'timestamp'))
I have problem when I want to get mPakage value.
lapply(myData, function(x) x$duration$taskInfo$baseIntent$mComponent$mPackage)
? – ThorneError in x$duration$taskInfo : $ operator is invalid for atomic vectors
– Koan