Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First Name Function #94

Open
ndavis4904 opened this issue Oct 9, 2021 · 2 comments
Open

First Name Function #94

ndavis4904 opened this issue Oct 9, 2021 · 2 comments

Comments

@ndavis4904
Copy link

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
Copy link

This might be helpful:
#67 (comment)

@ndavis4904
Copy link
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants