[R] bind function

Rolf Turner r.turner at auckland.ac.nz
Mon Aug 17 23:15:59 CEST 2015


On 18/08/15 07:07, mcferrae at mskcc.org wrote:

> HI there I'm very new to R, as in 3 days new, so apologies if I'm not
> framing my question correctly I am working through the Johns' Hopkins
> coursera course, I'm following, just about!
>
> I am trying to have R read multiple .csv files together as one
> dataframe - I can't figure how to ask the program to do so, despite
> multiple attempts, and googles' and re-reading the course materials.
>
> Please can you advise what a code might read like?


Well, I guess (???) this isn't *really* homework .....

Something like:

clyde  <- list.files(pattern="*.csv")
melvin <- lapply(clyde,read.csv)
irving <- do.call(rbind,melvin)

Note that the data frames read in by read.csv() must have identical 
column names.

Your question is very vague and indicative of a lack of focus.  (As in 
"Focus?  They don't even know us!)

Have you read (thoroughly and diligently) some basic introduction to R, 
such as "An Introduction to R" (!!!) available from the R web page?  Do so!

cheers,

Rolf Turner

-- 
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276



More information about the R-help mailing list