Watts-College / cpp-527-fall-2021

A course shell for CPP 527 Foundations of Data Science II
https://watts-college.github.io/cpp-527-fall-2021/
2 stars 6 forks source link

First Name Function #94

Open ndavis4904 opened 2 years ago

ndavis4904 commented 2 years ago

I have been trying to get everything ironed out, but the newest error message that has me stumped is" "Error in $<-.data.frame(*tmp*, name, value = list()) : replacement has 0 rows, data has 88"

I narrowed it down to my get_first_name() function which is as follows: `get_first_name <- function(full.name) { return2 <- function(x) {return(x[2])} x <- strsplit(as.character(full.name), ",") x <- sapply(x, return2) x <- trimws(x)

y <- sapply(strsplit(x, " "), '[',1) return(y) }`

It works running test code in both of the different formats between 2020 and following years. The frustrating part is that I did not get this error message in the 2020 file, but I have in each of the other years.

aawoods97 commented 2 years ago

This might be helpful: https://github.com/Watts-College/cpp-527-fall-2021/issues/67#issue-1014535592

ndavis4904 commented 2 years ago

The problem is that it works on a list of the names in both formats, just not once I get to the automated function. As I've been looking at it more, I think that there is a problem reading the files into R to begin with. When I run it by hand, it tells me: "EOF within quoted string". So I try turning off quoting, and instead I get the error message: "more columns than column names". Has anyone else run into this problem?