Skip to content

R中使用read.csv读取豆瓣电影数据时出错:列的数目比列的名字要多 #1

@Honlan

Description

@Honlan

我提供的豆瓣电影数据某些行存在缺失值,所以有的行的列数不一样,在mac下会自动处理,但是在windows下会报错。

可以尝试使用data.table包的fread()函数,读文件功能更强:
douban_movie_clean <- fread(filepath, header=TRUE, sep="^", encoding="UTF-8")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions