On 21.02.19 20:43, Rui Barradas wrote:
Hello,

I don't understand the question.
Like this?

xx <- "B"
yy <- "D"
a[xx, on = v]
a[c(xx, yy), on = v]

Note that .(xx, yy) doesn't work. It outputs something else.

Could you give an example of more complicated expressions you have doubts with?

Let's assume I'd like to create a subset like this, in data.frame syntax:

d[ (d[[v]] == a | d$b == "c") & d$c>2, ]

Here I have a column referenced by its name (stored in v), and compared to a value stored in a, and the whole thing is part of a more complex logical expression. I could write it in this conventional way, but I wondered whether there is a better way that would leverage some of data.tables syntax.

Pascal

______________________________________________
R-help@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.

Reply via email to