strong text Below is my objective and the code I made to represent that Row 19 is the original street text and 24 is where street2 is located https://www.opendataphilly.org/dataset/shooting-victims/resource/a6240077-cbc7-46fb-b554-39417be606ee << where the .csv is Let's deal with the streets with '&' separating their names. Create a new column named street2 and set it equal to NA. Then, iterate over the data frame using a for loop, testing if the street variable you created earlier contains an NA value. In cases where this occurs, separate the names in block according to the & delimiter into the fields street and street2 accordingly. Output the first 5 lines of the data frame to the screen. Hint: for; if; :; nrow(); is.na(); strsplit(); unlist().
NewLocation$street2 <- 'NA'
Task7 <- unlist(NewLocation)
for (col in seq (1:dim(NewLocation)[19])) {
if (Task7[street2]=='NA'){
for row in seq (1:dim(NewLocation[24])){
NewLocation[row,col] <-strsplit(street,"&",(NewLocation[row,col]))
}
}
}