[R] space in column name

cls59 chuck at sharpsteen.net
Sun Jul 19 20:42:32 CEST 2009



Farrel Buchinsky-3 wrote:
> 
> I read a table from Microsoft Access using RODBC. Some of the variables
> had
> a name with a space in it.
> R has no problem with it but I do.
> I cannot find out how to specify the space
> 
> names(alltime)
>  [1] "ID"            "LVL7"          "Ref Pv No"     "Ref Pv Name"   "DOS"
>         "Pt Last Name"  "Pt First Name" "MRN"           "CPT"          
> "CPT
> Desc"      "DxCd1"         "DxCd2"         "DxCd3"         "DxCd4"
> [15] "DOE"
> 
> But what do I do if I want to do something such as this
>> alltime[grep("MIDDLE EAR EXPLORE",alltime$CPT Desc,]
> Error: unexpected symbol in "alltime[grep("MIDDLE EAR EXPLORE",alltime$CPT
> Desc"
> 
> 
> Farrel Buchinsky
> 
> 


The following might work:

alltime[grep("MIDDLE EAR EXPLORE",alltime[[ "CPT Desc ]] ]

-Charlie

-----
Charlie Sharpsteen
Undergraduate
Environmental Resources Engineering
Humboldt State University
-- 
View this message in context: http://www.nabble.com/space-in-column-name-tp24559626p24559726.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list