[R] '=' vs '<-'
Doran, Harold
HDoran at air.org
Wed Nov 3 19:32:13 CET 2010
Yes, but <- is preferred. Note, there are also some differences. You can do the following:
> a <- 10
> b = 10
> identical(a,b)
[1] TRUE
And you can also do
> myFun <- function(x, y = 100){
+ result <- x*y
+ result}
> myFun(x = 20)
[1] 2000
But, you cannot use '<-' to define the arguments of a function
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
> Behalf Of km
> Sent: Wednesday, November 03, 2010 2:05 PM
> To: r-help at r-project.org
> Subject: [R] '=' vs '<-'
>
> Hi all,
>
> can we use '=' instead of '<-' operator for assignment in R programs?
>
> regards,
> KM
>
> ______________________________________________
> 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