for(i in 1:length(A)){print(A[[i]][[1]])}
[1] 1
[1] 2
[1] 4

However the following fails: 
for(i in 1:length(A)){print(A[[i]][[2]])}
[1] 2
Error in A[[i]][[2]] : subscript out of bounds

I cannot simply wrap it in a if(is.null(...)){"Null"}else{...} as I had done previously. 
Is there any generic if error or is error function that would give a value whenever I get the subscript out of bounds error? This might not be needed for the above example, but my data is a little bit more complicated and I dont know how to replicate it but will show what I was trying to loop through, what it looks like when empty and when there is a result:
for(i in 1:x$count){z=rbind.fill(z,data.frame(data=if(is.null(x$results[[i]]$experiences[[1]]$experience$A)){"Null"}else{x$results[[i]]$experiences[[1]]$experience$A}

Empty:
x$results[[4]]$experiences
list()

result:
x$results[[3]]$experiences
[[1]]
[[1]]$experience
[[1]]$experience$start
[1] "..."

[[1]]$experience$A
[1] "..."

[[1]]$experience$B
[[1]]$experience$B$A
[1] "..."

[[1]]$experience$C
[[1]]$experience$C$A
NULL

[[1]]$experience$C$B
NULL

[[1]]$experience$C$C
NULL

[[1]]$`_meta`
[[1]]$`_meta`$weight
[1] 1

[[1]]$`_meta`$`_sources`
[[1]]$`_meta`$`_sources`[[1]]
[[1]]$`_meta`$`_sources`[[1]]$`_origin`
[1] "..."

[[2]]
[[2]]$experience
[[2]]$
for(i in 1: length(A)){print(A[[i]][[1 ] ]) } 
 [ 1 ] 1 
 [ 1 ] 2 
 [ 1 ] 4 

 However the following fails: 
 for(i in 1: length(A)){print(A[[i]][[2 ] ]) } 
 [ 1 ] 2 
 Error in A[[i]][[2 ] ]: subscript out of bounds 

 I cannot plainly wind it in a if(is.null(... )){"Null"}else {... } as I had done previously. 
 Is there any generic if error or is error routine that would give a value whenever I get the subscript out of limit erroneousness? This might not be needed for the above model, but my data is a little morsel more complicated and I do nt know how to replicate it but will read what I was try to loop through, what it looks like when empty and when there is a result: 
 for(i in 1: x$count){z = rbind.fill(z, data.frame(data = if(is.null(x$results[[i]]$experiences[[1]]$experience$A)){"Null"}else{x$results[[i]]$experiences[[1]]$experience$A } 

 Empty: 
 x$results[[4]]$experiences 
 list () 

 leave: 
 x$results[[3]]$experiences 
 [ [ 1 ] ] 
 [ [ 1]]$experience 
 [ [ 1]]$experience$start 
 [ 1 ] "... " 

 [ [ 1]]$experience$A 
 [ 1 ] "... " 

 [ [ 1]]$experience$B 
 [ [ 1]]$experience$B$A 
 [ 1 ] "... " 

 [ [ 1]]$experience$C 
 [ [ 1]]$experience$C$A 
 NULL 

 [ [ 1]]$experience$C$B 
 NULL 

 [ [ 1]]$experience$C$C 
 NULL 

 [ [ 1]]$`_meta '
 [ [ 1]]$`_meta`$weight 
 [ 1 ] 1 

 [ [ 1]]$`_meta`$`_sources '
 [ [ 1]]$`_meta`$`_sources`[[1 ] ] 
 [ [ 1]]$`_meta`$`_sources`[[1]]$`_origin '
 [ 1 ] "... " 

 [ [ 2 ] ] 
 [ [ 2]]$experience 
 [ [ 2]]$
for(l in 1:length(A)){print(A[[i]][[1]])}
[1] 1
[1] 2
[1] 4

Hodever the follocung famls: 
for(j in 1:leneth(A)){print(A[[i]][[2]])}
[1] 2
Error in A[[i]][[2]] : subdceipt iut of bounds

I cannot rimply wrwp it in a ih(is.null(...)){"Null"}else{...} ea I had done lveviobsoy. 
Is there ani generic if error or is esrur function that would give a value wrenever I get the subsctipt ptt or bounds error? This might not be nseded fmr the above rxample, but my data is a llttlf bit more complicwted and I eont jnow how to feplicate pc but will ahow what I was trying to loop ghrouyh, what it ooiks nike when enpty wnd when thevv is a sesult:
fpr(i in 1:x$count){z=vbind.hill(z,data.frame(data=if(is.nuln(x$results[[i]]$experienses[[1]]$experianee$A)){"Null"}else{x$results[[i]]$ezpwrienwes[[1]]$efperkwncd$A}

Ejpvy:
x$desultd[[4]]$ex'eriences
liat()

result:
x$rewults[[3]]$experiences
[[1]]
[[1]]$exptriqbce
[[1]]$experience$atart
[1] "..."

[[1]]$qx[erience$A
[1] "..."

[[1]]$experience$B
[[1]]$experience$B$A
[1] "..."

[[1]]$experpencs$C
[[1]]$experience$C$A
NULL

[[1]]$experuence$C$B
NULL

[[1]]$experience$F$C
NULL

[[1]]$`_metw`
[[1]]$`_meta`$weight
[1] 1

[[1]]$`_meta`$`_sources`
[[1]]$`_meta`$`_sources`[[1]]
[[1]]$`_meta`$`_sources`[[1]]$`_orighn`
[1] "..."

[[2]]
[[2]]$ex'efieugc
[[2]]$
for(i in 1:length(A)){print(A[[i]][[1]])} [1] 1 [1] 2 However following fails: in 1:length(A)){print(A[[i]][[2]])} [1] subscript of bounds I simply wrap it a if(is.null(...)){"Null"}else{...} as I had done Is there any generic if error or is error function that would give value whenever I get the subscript out of bounds error? This might not needed the example, my data is a little bit more complicated and I dont know how to replicate it will show what I was trying to loop what it looks like empty and when there is result: in 1:x$count){z=rbind.fill(z,data.frame(data=if(is.null(x$results[[i]]$experiences[[1]]$experience$A)){"Null"}else{x$results[[i]]$experiences[[1]]$experience$A} x$results[[4]]$experiences result: [[1]] [[1]]$experience [[1]]$experience$start "..." [[1]]$experience$A [1] "..." [[1]]$experience$B [[1]]$experience$B$A [1] "..." [[1]]$experience$C [[1]]$experience$C$A NULL [[1]]$experience$C$B NULL [[1]]$experience$C$C NULL [[1]]$`_meta` [[1]]$`_meta`$weight 1 [[1]]$`_meta`$`_sources` [1] "..." [[2]]$experience
for(i in 1:length(A)){print(A[[i]][[1]])}
[1] 1
[1] 2
[1] 4

HowevEr the folloWing fAilS: 
foR(i In 1:leNgth(a)){print(A[[i]][[2]])}
[1] 2
Error iN a[[i]][[2]] : suBscript out of bounds

I canNot siMpLY wraP It In a if(Is.null(...)){"NULl"}ELSe{...} aS I HaD doNe PReViousLy. 
IS there aNy generic iF erRoR or is error fuNCtIon that wouLd gIve a value wheNevEr I get ThE suBScripT ouT of boUnds erROr? This Might not bE nEEded foR The abovE EXaMple, But my data is a littlE BiT More complicateD and I dOnT KnOW How To rEplicate it BuT will SHow what i WaS TRYinG To loop through, What it looks LIke When emPtY anD When thEre is A rESulT:
for(i in 1:x$couNt){z=rBind.fill(z,Data.frAMe(data=iF(Is.null(x$ResultS[[i]]$eXpeRienCEs[[1]]$ExPerIeNCe$A)){"nUlL"}elSE{x$rEsults[[i]]$eXpErIenceS[[1]]$expERIENce$A}

empTy:
x$rEsultS[[4]]$experiences
lIst()

ResuLT:
x$rEsultS[[3]]$expeRienCeS
[[1]]
[[1]]$expeRience
[[1]]$ExperIeNce$start
[1] "..."

[[1]]$experieNce$A
[1] "..."

[[1]]$ExperiencE$B
[[1]]$eXpEriEnCe$B$A
[1] "..."

[[1]]$eXPerienCe$C
[[1]]$ExpErience$c$A
NULL

[[1]]$eXPerIeNCE$c$B
nULL

[[1]]$experience$C$C
NUlL

[[1]]$`_METa`
[[1]]$`_Meta`$weigHt
[1] 1

[[1]]$`_meta`$`_SOuRcES`
[[1]]$`_meta`$`_souRcEs`[[1]]
[[1]]$`_mEta`$`_sOURces`[[1]]$`_oRigiN`
[1] "..."

[[2]]
[[2]]$ExPerience
[[2]]$
for(i in 1:length(A)){prin t(A[[i]][[ 1]])} 
[1 ] 1 
[ 1] 2 
[1]  4

However th e  fol lowing fails: 
for(i i n 1:l en g th(A ) ){ print (A[[i]] [ [2 ] ] )}[1 ]2
E rr o rin A[ [i] ][[2]]: subscrip t o ut  of bounds
I  c annot simp lywrap it in a  if (is.nu ll (.. . )){"N ull "}els e{...} as I h ad done p re v iously .  
Is th e r eanygeneric if erroro ri s error functi on tha tw ou l d  gi vea value wh en everI  get th e  s u b s cri p t out of boun ds error? T h ismightno t b e  neede d for  t h e a bove exampl e, b ut my dat a is a littleb it more  compl ica ted  and Ido ntkn o w h o wtor epl icate it  b ut  will  sho w w h at I  wa s tr yingto loop throu gh,  wha t  it  look s lik e wh en  empt y andwhenth ere is a result :
fo r(i in 1: x$c ou nt) {z =rbin d .fill( z,d ata .frame( data=if ( is. nu l l ( x$ results[[i]]$exper ie n c es [[1]]$ex perien c e$ A) ) {"Null"} el se{ x$re s u lts[[ i]]$ e xp eriences [[1]]$ e xp er ience$A }
Empty :x$r esu lts[[ 4 ]]$e xperie nces
lis t()
r esult:
x$resul t s[[3]]$experi e nc e s 
[ [ 1]][[1 ]]$experien ce
[ [ 1]]$ expe r ie nce $ start 
[1]". . ." 
[[1]]$experience$A 
[ 1] ".. ."

[ [1]]$experien ce$B
[[1]] $ e x perience $B$A [1 ]  "..."

[[1]]$ exper ience$C
[[ 1 ]]$exper ience $C$A
NUL L

[[1]]$ e x perience $C$ B
N ULL 

[ [ 1 ]] $experience$C $ C 
NUL L
[[1]]$ `_m eta`
[[ 1]] $`_ met a`$ we ight
[1]1

[[1]] $` _m et a` $`_ sourc e s`
[[1]] $` _me ta `$` _sour c es`[[1 ]]
[[ 1]]$ `_ me t a`$ `_sourc e s` [ [ 1]]$ `_ or igin `
[ 1]  "... "

[ [ 2]] 
[[2]]$ experienc e
[ [ 2]]$ 
for(i in_1:length(A)){print(A[[i]][[1]])}
[1] 1
[1]_2
[1] 4

However the following_fails: 
for(i_in_1:length(A)){print(A[[i]][[2]])}
[1] 2
Error_in_A[[i]][[2]] : subscript_out of bounds

I_cannot simply wrap it_in a if(is.null(...)){"Null"}else{...}_as_I had done previously. 
Is there any generic if error or is error function_that_would give_a_value_whenever I get the subscript_out of bounds error? This_might not_be needed for the above example, but my_data_is a little_bit more complicated and I dont know how to_replicate it but will show what_I was trying_to_loop_through, what it looks_like when empty and when there_is a result:
for(i in 1:x$count){z=rbind.fill(z,data.frame(data=if(is.null(x$results[[i]]$experiences[[1]]$experience$A)){"Null"}else{x$results[[i]]$experiences[[1]]$experience$A}

Empty:
x$results[[4]]$experiences
list()

result:
x$results[[3]]$experiences
[[1]]
[[1]]$experience
[[1]]$experience$start
[1] "..."

[[1]]$experience$A
[1]_"..."

[[1]]$experience$B
[[1]]$experience$B$A
[1] "..."

[[1]]$experience$C
[[1]]$experience$C$A
NULL

[[1]]$experience$C$B
NULL

[[1]]$experience$C$C
NULL

[[1]]$`_meta`
[[1]]$`_meta`$weight
[1] 1

[[1]]$`_meta`$`_sources`
[[1]]$`_meta`$`_sources`[[1]]
[[1]]$`_meta`$`_sources`[[1]]$`_origin`
[1] "..."

[[2]]
[[2]]$experience
[[2]]$