s-news
[Top] [All Lists]

odd string behavior

To: s-news@lists.biostat.wustl.edu
Subject: odd string behavior
From: Stafford Phillip-APS095 <phillip.stafford@motorola.com>
Date: Sun, 23 Dec 2001 15:10:06 -0600
To those familiar with string manipulations in S+:


In S+ 2000 I have a data.frame with row names that look like this:

AA_03034
AA_03211
etc.

When I use match() to subset this data.frame with row names from another 
data.frame (either saved as a character vector or using row.names()) I wind up 
with this:

source contains AA_003034
target contains AA_003034, AA_03211, AA_03222, etc.

The resuls is this:

AA.003034       data    data    data
NA              NA      NA      NA
NA1             NA      NA      NA

and na.exclude gets rid of the NA's.  However, note the name change for the row 
name:  my underscore changes to a period and it only does this after the 
subsetting function gets to an NA - if it never produces an NA the underscore 
stays an underscore.  Anyone know why this happens?  It wouldn't be a problem 
to fix the names except there are a variable number of underscores in the row 
names.

Thanks for any insight(ful);

Phillip

<Prev in Thread] Current Thread [Next in Thread>
  • odd string behavior, Stafford Phillip-APS095 <=