Hello,
OK, I had some spare time. Try
readCSVFile <- function(filename){
lns <- readLines(filename)
lns <- lns[sapply(lns, nchar) > 0]
lns <- gsub(" ", "", lns)
lns <- sub(";$", "", lns)
i_title <- grep("[[:alpha:]]", lns)
blocks <- lapply(seq_along(i_title)[-1], function(i){
The csv file is exported from Windows (dos format), so the line break is
different from Unix.
在 星期一, 07 十月 2019 01:18:54 -0700 撰写
> I am mad about importing this strange csv format type.
>
> The real csv has been attached now. The raw data points are huge.
>
> Many thanks.
>
Hello,
It is not clear if all files have
* a first block with just one data line
* all other blocks with as many rows as the numbers in that first data line.
If yes, maybe something like this?
lns <- readLines("strange.csv")
lns <- lns[sapply(lns, nchar) > 0]
lns <- sub(",$", "", lns)
i_title
On 06/10/2019 8:23 a.m., vod vos wrote:
The problem is aa, bb and cc all in a single csv file
contains no blank line.
So what steps do you need, and which of them do you need help with?
Duncan Murdoch
The single csv file like list output.
aa(cm)
1, 2 , 3,
bb(mm)
1, 2, 3,
4, 5, 6,
The problem is aa, bb and cc all in a single csv file
contains no blank line.
The single csv file like list output.
aa(cm)
1, 2 , 3,
bb(mm)
1, 2, 3,
4, 5, 6,
7, 8, 9,
cc(mm)
3, 4, 5,
7, 5, 9,
6, 5, 8,
在 星期日, 06 十月 2019 05:08:41 -0700 Duncan Murdoch
撰写
> On 06/10/2019 7:
On 06/10/2019 7:29 a.m., vod vos via R-help wrote:
I got hundreds of csv files. The real formats in each csv file are as follows:
aa(cm)
1, 2 , 3,
bb(mm)
1, 2, 3,
4, 5, 6,
7, 8, 9,
cc(mm)
3, 4, 5,
7, 5, 9,
6, 5, 8,
How can I use read.table or read.csv to convert the csv files
to a tidy data f
I got hundreds of csv files. The real formats in each csv file are as follows:
aa(cm)
1, 2 , 3,
bb(mm)
1, 2, 3,
4, 5, 6,
7, 8, 9,
cc(mm)
3, 4, 5,
7, 5, 9,
6, 5, 8,
How can I use read.table or read.csv to convert the csv files
to a tidy data frame format as follow:
aa, bb, cc
1, 1, 3
1, 2, 4
1
7 matches
Mail list logo