As already mentioned, having no column names is simply not what will happen to the data frame, but I kind of guess that you don't care if they are there, you just don't want to see them when printing the data frame? If so, you can write a new print function to get around this, for example:
> dat <- data.frame(var1=c("A","B","C"),var2=rnorm(3),var3=rnorm(3)) > print(dat) var1 var2 var3 1 A 1.2771777 -0.5726623 2 B -1.5000047 1.3249348 3 C 0.1989117 -1.4016253 > ncol.print <- function(dat) print(matrix(as.matrix(dat),ncol=ncol(dat),dimnames=NULL),quote=F) > ncol.print(dat) [,1] [,2] [,3] [1,] A 1.2771777 -0.5726623 [2,] B -1.5000047 1.3249348 [3,] C 0.1989117 -1.4016253
Another option: it sets variable names to unique numbers of spaces, for example:
> names(dat) <- c(" ", " ", " ") > dat 1 A 1.2771777 -0.5726623 2 B -1.5000047 1.3249348 3 C 0.1989117 -1.4016253
You can also write a function:
> blank.names <- function(dat){ + for(i in 1:ncol(dat)){ + names(dat)[i] <- paste(rep(" ",i),collapse="") + } + return(dat) + } > dat <- data.frame(var1=c("A","B","C"),var2=rnorm(3),var3=rnorm(3)) > dat var1 var2 var3 1 A -1.01230289 1.2740237 2 B -0.13855777 0.4689117 3 C -0.09703034 -0.4321877 > blank.names(dat) 1 A -1.01230289 1.2740237 2 B -0.13855777 0.4689117 3 C -0.09703034 -0.4321877
But usually I donโt think it should be done.