1) sqldf can handle names that have periods in them if you specify names:
library(sqldf) d0 <- read.csv(text = "AB,CD\n1,2") sqldf('select "AB", "CD" from d0')
giving:
AB CD 1 1 2
2) When reading data using read.table or read.csv use the argument check.names=FALSE .
For comparison:
Lines <- "AB,CD 1,2 3,4" read.csv(text = Lines) ## AB CD ## 1 1 2 ## 2 3 4 read.csv(text = Lines, check.names = FALSE) ## ABCD ## 1 1 2 ## 2 3 4
however, in this example, it still leaves the name that should be specified in sqldf, since the names have built-in spaces.
3) To simply delete periods if DF is a data frame:
names(DF) <- gsub(".", "", names(DF), fixed = TRUE)
or it would be better to convert periods to underscores so that they are reversible:
names(DF) <- gsub(".", "_", names(DF), fixed = TRUE)
This last line can be done as follows:
names(DF) <- chartr(".", "_", names(DF))