I sifted some more and read about a workaround for the problem. I could simply rename the columns so that there were no more spaces names(alltime) <-gsub(" ",".", names(alltime))
> 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" Farrel Buchinsky Google Voice Tel: (412) 567-7870 Sent from Pittsburgh, Pennsylvania, United States On Sun, Jul 19, 2009 at 14:32, Farrel Buchinsky <fjb...@gmail.com> 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 > > > Sent from Pittsburgh, Pennsylvania, United States > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.