Question: I've many string files (.str), and I want to import them in R (looping on files).
The problem is that the first line is neither columns name nor the beginning of the matrix.. It is a comment line. Idem for the last line.
between those two lines, stand up the matrix I want to import..
How can I do that ?

Thx

Answer: 
If you want to skip the first *and* last lines in a file, you can do it as follows. Use `readLines` to read the file into a character vector, and then pass it to `read.csv`.

```
strs <- readLines("filename.csv")
dat <- read.csv(text=strs,             # read from an R object rather than a file
                skip=1,                # skip the first line
                nrows=length(strs) - 3 # skip the last line
                )

```

The `- 3` is because the number of rows of data is 3 less than the number of lines of text in the file: 1 skipped line at the beginning, 1 line of column headers, and 1 skipped line at the end. Of course, you could also just ignore the `nrows` argument, and delete the nonsense row from your data frame after the import.
You can skip arbitrary lines anywhere in the file if you combine the `readLines` approach Hong Ooi gives together with negative indexing. Here's an example which skips lines 2-5 in a file that has headers but a number lines of annotation/meta info:

```
lines <- readLines('myfile.txt')
mytable <- read.table(text = lines[-c(2:5)], sep = '\t', header = T)

```