Many thanks to all for their help. Factors are indeed very tricky and
sided on the conversion to character.
Kind regards,
Ivan
On 22 Oct 2008, at 19:01, Duncan Murdoch wrote:
On 10/22/2008 12:09 PM, Ivan Alves wrote:
Dear all,
Thanks for all the replies.
I get something with Duncan's code (s
You could do something like this:
> Name.x=c('nx1','nx2',NA,NA)
> Name.y=c('ny1','NA','ny3',NA)
> Name=Name.x
> Name[is.na(Name.x)]=Name.y[is.na(Name.x)]
> Name
[1] "nx1" "nx2" "ny3" NA
Julian
Ivan Alves wrote:
Dear all,
I searched the mail archives and the R site and found no guidance (t
On 10/22/2008 12:09 PM, Ivan Alves wrote:
Dear all,
Thanks for all the replies.
I get something with Duncan's code (slightly more compact than the
other two), but of class "integer", whereas the two inputs are class
"factor". Clearly the name information is lost. I did not see
anything on
Dear all,
Thanks for all the replies.
I get something with Duncan's code (slightly more compact than the
other two), but of class "integer", whereas the two inputs are class
"factor". Clearly the name information is lost. I did not see
anything on this in the help page for ifelse.
On thi
On 10/22/2008 11:21 AM, Ivan Alves wrote:
Dear all,
I searched the mail archives and the R site and found no guidance
(tried "merge", "cbind" and terms like "coalesce" with no success).
There surely is a way to coalesce (like in SQL) columns in a
dataframe, right? For example, I would li
Not tested, but for data.frame 'df', try
df$coal <- ifelse(!is.na(df$Name.x), df$Name.x, df$Name.y)
But see the help page for 'ifelse' regarding issues with classes, and
the myriad R-help posts on the 'ifelse' function.
Erik
Ivan Alves wrote:
Dear all,
I searched the mail archives and the
Dear all,
I searched the mail archives and the R site and found no guidance
(tried "merge", "cbind" and terms like "coalesce" with no success).
There surely is a way to coalesce (like in SQL) columns in a
dataframe, right? For example, I would like to go from a dataframe
with two column
7 matches
Mail list logo