Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在R-bind中传递数据帧 ULTRON_R_Dataframe_Rbind_Read.csv - Fatal编程技术网

在R-bind中传递数据帧 ULTRON

在R-bind中传递数据帧 ULTRON,r,dataframe,rbind,read.csv,R,Dataframe,Rbind,Read.csv,函数采用两个(或更多)数据帧并按行将它们连接在一起。换句话说,它将两个数据帧“堆叠”在一起。如果一个数据帧的列数大于或小于另一个数据帧的列数,则R将不允许该操作发生(尽管有关此操作的方法,请参见rbind.fill) dat更像r的方法是dat。此外,这显然来自Coursera作业集,并且已经被多次询问和回答。请在rbind污染物上搜索更多示例。请注意,Coursera课程希望您使用该课程的网页帮助论坛。我知道我必须使用这些论坛,我也在那里问过类似的问题。。我无法理解,并且认为更多的观众能够以不

函数采用两个(或更多)数据帧并按行将它们连接在一起。换句话说,它将两个数据帧“堆叠”在一起。如果一个数据帧的列数大于或小于另一个数据帧的列数,则R将不允许该操作发生(尽管有关此操作的方法,请参见
rbind.fill


dat更像r的方法是
dat。此外,这显然来自Coursera作业集,并且已经被多次询问和回答。请在
rbind污染物
上搜索更多示例。请注意,Coursera课程希望您使用该课程的网页帮助论坛。我知道我必须使用这些论坛,我也在那里问过类似的问题。。我无法理解,并且认为更多的观众能够以不同的方式详细解释ways@docendodiscimus:我可以使用该代码,但我需要输入id,如何使用该代码?在该代码中没有获取id的选项。
ULTRON <- function(directory, pollutant, id = 1:332) {

        files_full <- list.files(directory, full.names = TRUE)       

        dat <- data.frame()

        for (i in id) {

                dat <- rbind(dat, read.csv(files_full[i]))
        }

    mean(dat[, pollutant], na.rm = TRUE)
}
dat <- rbind(dat, read.csv(files_full[i]))
dat <- rbind(dat, read.csv(files_full[i]))