[R] Italicized title from index

Henrique Dallazuanna wwwhsd at gmail.com
Thu Mar 31 14:01:45 CEST 2011


Better:

plot(1, main = bquote("Yield  for " ~ italic(.(as.character(spp))) ~
"in management region" ~ .(region)))

You have a factor, so you need convert it to character


On Thu, Mar 31, 2011 at 8:59 AM, Henrique Dallazuanna <wwwhsd at gmail.com> wrote:
> Try this:
>
> plot(1, main = bquote("Yield  for " ~ italic(.(spp)) ~ "in management
> region" ~ .(region)))
>
> On Thu, Mar 31, 2011 at 2:35 AM, Jeremy Newman <jnewm101 at uottawa.ca> wrote:
>> Hi all!
>>
>> I've written a handy script that uses a for loop to allow me to generate a
>> large number of figures and statistical outputs for a large dataset.
>>
>> I am using indexing to retrieve a species name for the title of my graphs-
>> which worked fine. However, I need to italicize these species names.
>>
>> I originally used the paste function, and had no problems with indexing:
>>
>> *main=paste("Yield for ", testsub[1,3], " in management region ",
>> testsub[1,2])*
>>
>> The title looks like: "*Yield for Gadus morhua in management region 4X5Y*"
>>
>> I tried bquote from a related help thread, I tried to emulate it:
>>
>> *spp<-testsub[1,3]*
>> *region<-testsub[1,2]*
>> *
>> *
>> *main=bquote(Yield ~ for ~ italic(.(spp)) ~ in ~ management ~ region ~
>> .(region))*
>>
>> Which doesn't seem to work at all, but when I try not putting anything after
>> the italic:
>>
>> *main=bquote(Yield ~ for ~ italic(.(spp)))*
>>
>> I get: "*Yield for 1*"
>> While *spp=Gadus morhua*
>>
>> I'm at wit's end, I tried to read about substitute, expression, and eval
>> functions in the hopes I can figure it out, but I am lost!
>>
>> Thanks for any help!
>>
>> Cheers,
>>
>> -Jeremy N
>>
>> Undergraduate Researcher in Macroecology
>> University of Ottawa
>> Department of Biology
>>
>> Ad astra per alia porci!
>>
>>        [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> 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.
>>
>
>
>
> --
> Henrique Dallazuanna
> Curitiba-Paraná-Brasil
> 25° 25' 40" S 49° 16' 22" O
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O



More information about the R-help mailing list