[R] Storing tableGrobs in a list
Stats Student
@t@t@@@tudent4647 @end|ng |rom gm@||@com
Fri Jun 15 03:42:02 CEST 2018
Thanks. The trick was in the do.call() syntax -
p1<-do.call(gtable_combine, c(L1, list(along=2)))
On Jun 14, 2018, 6:30 PM, at 6:30 PM, Jeff Newmiller <jdnewmil using dcn.davis.ca.us> wrote:
>I don't know gtable_combine well enough to answer based on hand waving.
>A reproducible example is more likely to tempt someone to dig a little.
>
>On June 14, 2018 8:07:19 AM HST, Stats Student
><stats.student4647 using gmail.com> wrote:
>>Thanks for the replies. Wasn't aware that Gmail on Android sent HTML
>by
>>default, apologies.
>>
>>Storing the tableGrob-s in a list worked but for some reason
>>grid.arrange complains on output from gtable_combine() using lists vs
>>individual tableGrob-s.
>>
>># works when supplying individual tableGrobs
>>
>>p1<-gtable_combine(p11,p22, along=2)
>>p2<-gtable_combine(p11,p22, along=2)
>>grid.arrange(p1,p2,ncol=2)
>>
>># breaks when supplying a list of tableGrobs, error from
>grid.arrange()
>>
>>p1<-gtable_combine(L1,along=2)
>>p2<-gtable_combine(L2,along=2)
>>
>>grid.arrange(p1,p2,ncol=2)
>>
>>Error in gList(list(list(grobs = list(list(label = "status", x = 0.5,
>>:
>> only 'grobs' allowed in "gList"
>>
>>Also tried, still no go
>>
>>p1<-do.call(gtable_combine, list(L1,along=2))
>>p2<-do.call(gtable_combine, list(L2,along=2))
>>
>>
>>
>>
>>On Jun 13, 2018, 11:01 PM, at 11:01 PM, Jeff Newmiller
>><jdnewmil using dcn.davis.ca.us> wrote:
>>>?`[[`
>>>
>>>and read the discussions of indexing in the Introduction to R
>document
>>>that comes with R. Also, find a way to predict the number of elements
>>>you will need as making this a habit will pay off big time when you
>>>work with large amounts of data:
>>>
>>>L1<-vector( "list", N )
>>>for (i in seq.int( N )) {
>>> L1[[i]] <-tableGrob( ... )
>>>}
>>>
>>>PS Post using your email program "plain text" mode... HTML gets
>>>stripped anyway and that often leads to partial corruption of your
>>>message. Read the Posting Guide.
>>>
>>>On June 13, 2018 4:43:21 PM HST, Stats Student
>>><stats.student4647 using gmail.com> wrote:
>>>>Hi, I'm trying to generate tableGrobs in a loop, store them in a
>list
>>>>so I
>>>>can use it in a call to gtable_combine().
>>>>
>>>>L1<-list()
>>>>for (i in seq( ... )) {
>>>> L1[i] <-tableGrob( ... )
>>>>}
>>>>
>>>>gtable_combine(L1, along=1)
>>>>
>>>>On the assignment inside the loop, I get "number of items to replace
>>>is
>>>>not
>>>>a multiple of replacement length" which I'm guessing has to do with
>>>the
>>>>tableGrob object not "fitting" in the list but am not sure how to
>fix
>>>>it.
>>>>
>>>>Thanks in advance for any pointers.
>>>>
>>>> [[alternative HTML version deleted]]
>>>>
>>>>______________________________________________
>>>>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>>>https://stat.ethz.ch/mailman/listinfo/r-help
>>>>PLEASE do read the posting guide
>>>>http://www.R-project.org/posting-guide.html
>>>>and provide commented, minimal, self-contained, reproducible code.
>>>
>>>--
>>>Sent from my phone. Please excuse my brevity.
>
>--
>Sent from my phone. Please excuse my brevity.
More information about the R-help
mailing list