I have completed part 2 of the assignment and am getting the desired output. But on submitting the code, it shows as the answer is incorrect along with this message: function (..., list = character(), package = NULL, lib.loc = NULL, verbose = getOption("verbose"), envir = .GlobalEnv) Result: Sorry, your answer was incorrect. The following is my code for part 2: complete <- function(directory, idvec = 1:332) { df <- data.frame(id = integer(), nobs = integer()) for (id in idvec) { filename <- paste(directory, "/", sprintf("%03d", as.integer(id)), 5 ".csv", sep = "") filename <- list.files() dat <- rbind(dat, read.csv(filename[id])) } str(data) for (id in idvec) {nd <- data.frame(id = id, nobs = nrow(na.omit(dat))) df <- rbind(df, nd) } return(df) } I am using R 3.2.1 on a Windows 8 laptop. How shall I solve this? Thanks and regards Nikita [[alternative HTML version deleted]]
On Sun, Aug 16, 2015 at 12:39 PM, Nikita Dinger <dingernikita at gmail.com> wrote:> I have completed part 2 of the assignment and am getting the desired output. > But on submitting the code, it shows as the answer is incorrect along with > this message:This list is not an appropriate place for you to ask for help with your homework. Your course should have a way for you to get assistance from instructor/TA/other students; this is not that way. We on R-help can't do much for you, since none of us have any idea what "part 2" might be, and the list has a no-homework policy anyway.> function (..., list = character(), package = NULL, lib.loc = NULL, verbose > = getOption("verbose"), > envir = .GlobalEnv) > Result: Sorry, your answer was incorrect. > > The following is my code for part 2: > > complete <- function(directory, idvec = 1:332) { > df <- data.frame(id = integer(), nobs = integer()) > for (id in idvec) { > filename <- paste(directory, "/", > sprintf("%03d", as.integer(id)), > 5 ".csv", sep = "") > filename <- list.files() > dat <- rbind(dat, read.csv(filename[id])) > } > str(data) > for (id in idvec) > {nd <- data.frame(id = id, > nobs = nrow(na.omit(dat))) > df <- rbind(df, nd) > } > return(df) > > } > > I am using R 3.2.1 on a Windows 8 laptop. > > How shall I solve this? > > Thanks and regards > Nikita >-- Sarah Goslee http://www.functionaldiversity.org
Go to where you were given this assignment and ask them for help. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. On August 16, 2015 9:39:28 AM PDT, Nikita Dinger <dingernikita at gmail.com> wrote:>I have completed part 2 of the assignment and am getting the desired >output. >But on submitting the code, it shows as the answer is incorrect along >with >this message: > >function (..., list = character(), package = NULL, lib.loc = NULL, >verbose >= getOption("verbose"), > envir = .GlobalEnv) >Result: Sorry, your answer was incorrect. > >The following is my code for part 2: > >complete <- function(directory, idvec = 1:332) { > df <- data.frame(id = integer(), nobs = integer()) > for (id in idvec) { > filename <- paste(directory, "/", > sprintf("%03d", as.integer(id)), > 5 ".csv", sep = "") >filename <- list.files() > dat <- rbind(dat, read.csv(filename[id])) >} >str(data) >for (id in idvec) > {nd <- data.frame(id = id, > nobs = nrow(na.omit(dat))) > df <- rbind(df, nd) > } > return(df) > >} > >I am using R 3.2.1 on a Windows 8 laptop. > >How shall I solve this? > >Thanks and regards >Nikita > > [[alternative HTML version deleted]] > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.