I am new to R and was trying out the following code. To my surprise, assigning something to ret$log.id
would actually caused to same value to be assigned to ret$log
as well. E.g.,
ret <- c()
ret$log.id <- 'a'
Running the following would return "a"
ret$log
Is this what R supposed to do? I am hoping someone can give me some insight into this.
Thanks,
Yes, the $ operator is doing some partial matching. You can explore the behavior a little with the following:
ret <- c()
ret$log.id <- "a"
ret$l #Returns "a"
ret$log.at <- "b"
Now see what's returned with the following:
ret$l
ret$log
ret$log.i
ret$log.a
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With