Using pivot_longer in R in Kaggle, producing NAs for second half of data

66 views Asked by At

Here is the data frame that I started with.

enter image description here I tried to change it from wide to long using this code:

#change data frame from wide to long
us_population_v3 <- pivot_longer(us_population_v2, cols = !1, names_to = "year", values_to = "total_population")
View(us_population_v3)

It created a new data frame, but the second half of the data is missing. I'm not sure why or how to fix it. This is part of what it produced. The first half looks correct, but the second half is NA and says "exported on..."

enter image description here

I tried turning the data frame from wide to long. I'm not sure what to try from here.

0

There are 0 answers