[R] subscript with comma

Duncan Murdoch murdoch.duncan at gmail.com
Wed Jan 4 23:34:45 CET 2012


On 12-01-04 11:41 AM, suse wrote:
> Thank you! It works now.
> But I still don't understand, how all these expressions, "", paste, group,
> eval... have to be used together.  (For example, I first tried
> expression(sm[w,grass]) but it didn't work, and I couldn't find, why (and
> when) commas are interpreted here differently). So: Is there somewhere an
> introduction (rather than examples) to this? Books, documents etc.

You could try the reference from the ?plotmath page, but I don't think 
it is a tutorial, which seems to be what you want.

Basically the examples are how to do it.  Learn what expressions are 
like in R, then put together the pieces from demo(plotmath) by building 
expressions containing those pieces.

I don't see anything like sm[w,grass] in the demos, so I would just try 
it to see what happens:  and as you found, it doesn't work.

But there is an example with commas (list(x,y,z)) and an example with 
subscript (x[i]), so you should be able to guess that sm[list(w,grass)] 
would work, and it does!

Duncan Murdoch

>
> --
> View this message in context: http://r.789695.n4.nabble.com/subscript-with-comma-tp4261579p4261931.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.



More information about the R-help mailing list