Message-ID: <Pine.SOL.3.96.1030514121147.18819A-100000@draco.cus.cam.ac.uk>
Date: 2003-05-14T11:19:39Z
From: Damon Wischik
Subject: <-
In-Reply-To: <3EC1E4DB.3060100@statistik.uni-dortmund.de>
Uwe Ligges wrote:
> Perl experts might do it differently, but the "R way" seems to be
> substring(x, 1, 1) <- toupper(substring(x, 1, 1))
> substring(x, 2) <- tolower(substring(x, 2))
I hadn't come across this use of substring on the left hand side of <-
before. Now, of course, I see it explained on the help page for substr.
What other special functions can appear on the left hand side of <-? Is
there anywhere I can look to find a list? I've come across
vector[vector of logicals] <-
vector[vector of integers] <-
data.frame[] <-
One thing I would find very handy is a shortcut for
res <- myfunc()
a <- res$val1
b <- res$val2
Something along the lines of
list(a=val1,b=val2) <- myfunc()
but I don't know what the right syntax would be or how I'd go about
programming it. Any suggestions?
Damon Wischik.