Hi Bert
I am aware of factor features and frankly speaking I consider them quite
usefull despite of prevalent preference to character vectors. For the OP
question seems to me that ifelse construction is appropriate, based on his
statement he has 2 strings which shall be converted to another two
... Well, this works in this simple case, but is too clumsy for a general
formulation of this problem: given a "dictionary" consisting of two
character vectors of unique "names" (or two columns in a data frame), x and
y, how does one convert a factor z with levels in x into the corresponding
equi
Hi
If you want to get rid of regular expressions at all and your A values
start AWI for Arctic and UFT for boreal you can
DF$D <- ifelse(substr(DF$A, 1,1) == "A", "Arctic", "Boreal")
Regards
Petr
>
> Hello,
> I am just starting with R and I am having a (most probably) stupid
problem
> by c
On 10/24/2011 12:35 AM, Philipp Fischer wrote:
Hello,
I am just starting with R and I am having a (most probably) stupid problem by
creating a new variable in a data.frame based on a part of another character
variable.
I have a data frame like this one:
A B
Use regular expressions
?grepl
On Sunday, October 23, 2011, Philipp Fischer wrote:
> Hello,
> I am just starting with R and I am having a (most probably) stupid problem
by creating a new variable in a data.frame based on a part of another
character variable.
>
> I have a data frame like this one
Hello,
I am just starting with R and I am having a (most probably) stupid problem by
creating a new variable in a data.frame based on a part of another character
variable.
I have a data frame like this one:
A B C
AWI-test1 1 i
AWI-test5
6 matches
Mail list logo