Hi there,
I'm trying to use pivot_wider to convert rows to columns for what appears to be a dataframe of 200,000 rows and 16 columns.
and got the following error:
Error: Column 1 must be named.
Use .name_repair to specify repair.
Run `rlang::last_error()` to see where the error occurred.
In addition: Warning message:
Values in `VALUE` are not uniquely identified; output will contain list-cols.
* Use `values_fn = list(VALUE = list)` to suppress this warning.
* Use `values_fn = list(VALUE = length)` to identify where the duplicates arise
* Use `values_fn = list(VALUE = summary_fun)` to summarise duplicates
At first I thought the error had to do with missing values in the column that I want to convert to col names, but when I used dput to get a sample for this post I ran into a strange problem where it appears my data is not a simple df and contains a huge amount of data nested within the df.
for example, this is what happens when I use dput to reproduce just the first row of data (I had to cut it short because it goes over the limit for a post in r studio community)
sample <- head(df, 1)
dput(sample)
"99,674", "99,674,000", "99,675", "99,676", "99,676,000",
"99,677,000", "99,678", "99,678,000", "99,679,000", "99,680",
"99,681", "99,682,000", "99,683,000", "99,684", "99,685",
"99,686", "99,687", "99,689,000", "99,690", "99,691", "99,692",
"99,692,000", "99,693", "99,694", "99,695", "99,696,000",
"99,697", "99,699", "99,699,000", "99,700", "99,701", "99,702",
"99,702,872", "99,703", "99,704", "99,706", "99,707", "99,710",
"99,711", "99,712", "99,713", "99,714", "99,716", "99,718",
"99,719", "99,720", "99,720,000", "99,721", "99,723", "99,725",
"99,727", "99,727,000", "99,728", "99,728,000", "99,729",
"99,730", "99,731", "99,732", "99,733", "99,733,000", "99,735,000",
"99,736", "99,736,000", "99,737", "99,739", "99,739,000",
"99,740", "99,741", "99,741,000", "99,745", "99,745,000",
"99,746", "99,747", "99,750,000", "99,751", "99,751,000",
"99,752", "99,753", "99,754", "99,755", "99,757,000", "99,758",
"99,759", "99,760", "99,761", "99,761,000", "99,762", "99,762,000",
"99,763", "99,763,000", "99,763,950", "99,764", "99,764,141,000",
"99,766", "99,766,000", "99,767,000", "99,768", "99,771",
"99,772", "99,775", "99,775,000", "99,776", "99,776,000",
"99,777", "99,777,000", "99,778", "99,778,000", "99,779",
"99,779,226", "99,780", "99,781", "99,781,000", "99,782",
"99,784", "99,784,000", "99,785", "99,786", "99,787,000",
"99,788", "99,790", "99,790,000", "99,791", "99,791,000",
"99,792,000", "99,794", "99,796", "99,797", "99,798", "99,798,000",
"99,799", "99,800", "99,801", "99,803", "99,803,000", "99,804",
"99,805", "99,807", "99,807,049", "99,809", "99,809,000",
"99,810", "99,813", "99,814", "99,815", "99,816", "99,817",
"99,819", "99,821", "99,824", "99,824,000", "99,825", "99,826",
"99,826,000", "99,827", "99,827,000", "99,829", "99,830",
"99,830,000", "99,831,000", "99,833", "99,835", "99,836",
"99,836,000", "99,837", "99,839", "99,839,000", "99,840",
"99,840,000", "99,842", "99,842,000", "99,843", "99,844",
"99,845", "99,845,000", "99,846", "99,848", "99,850", "99,851",
"99,851,000", "99,853", "99,854", "99,854,000", "99,855",
"99,856", "99,857", "99,857,000", "99,860,000", "99,864",
"99,865", "99,866", "99,866,000", "99,867", "99,867,000",
"99,868", "99,869", "99,869,000", "99,869,561", "99,870",
"99,870,000", "99,872", "99,873", "99,875", "99,876", "99,879",
"99,880", "99,880,000", "99,880,332", "99,882", "99,883",
"99,883,000", "99,884", "99,886", "99,887", "99,887,013,000",
"99,888", "99,889", "99,892", "99,893,000", "99,894,000",
"99,895", "99,896", "99,897", "99,897,000", "99,898", "99,900",
"99,901", "99,904", "99,904,000", "99,907,000", "99,909",
"99,911", "99,912", "99,912,000", "99,913", "99,914", "99,915",
"99,916,000", "99,917", "99,918", "99,920", "99,921", "99,922,000",
"99,923", "99,924", "99,924,000", "99,925", "99,926", "99,927",
"99,927,000", "99,928", "99,929", "99,930", "99,930,000",
"99,931", "99,932,000", "99,933", "99,938", "99,942", "99,943",
"99,944", "99,945,000", "99,946", "99,947", "99,947,000",
"99,948", "99,950", "99,951", "99,953", "99,954,000", "99,955,640",
"99,956", "99,957", "99,958", "99,959", "99,959,000", "99,961",
"99,961,000", "99,963", "99,965", "99,965,000", "99,969",
"99,970", "99,971", "99,972,000", "99,973", "99,974", "99,974,000",
"99,975,000", "99,976,000", "99,980,000", "99,982", "99,983",
"99,986", "99,987", "99,987,000", "99,990", "99,990,000",
"99,992", "99,994", "99,995,000", "99,995,601,000", "99,997",
"99,997,000", "99,998", "99,999,000", "99.3", "99.5", "990",
"990,000", "990,040", "990,043,000", "990,113", "990,146,000",
"990,189", "990,192", "990,243", "990,250", "990,263", "990,269",
"990,293", "990,305,000", "990,312", "990,409", "990,413",
"990,423", "990,434", "990,464", "990,469,000", "990,521",
"990,536,000", "990,557,000", "990,558", "990,572,000", "990,575",
"990,599", "990,653,000", "990,654", "990,682", "990,691",
"990,696,000", "990,715", "990,732", "990,735", "990,744",
"990,747,000", "990,760,000", "990,786", "990,790", "990,805,000",
"990,822", "990,825", "990,915", "990,927", "990,944", "990,964",
"990,988", "991", "991,000", "991,014", "991,022", "991,035,000",
"991,048", "991,101", "991,117,000", "991,118", "991,168",
"991,180", "991,183,000", "991,193", "991,197", "991,206",
"991,220", "991,221,000", "991,228,000", "991,324", "991,331",
"991,337", "991,367", "991,374", "991,399", "991,476", "991,533",
"991,542", "991,559", "991,560", "991,565", "991,629", "991,645",
"991,716", "991,717", "991,747,261", "991,750", "991,754,000",
"991,759,000", "991,762", "991,763", "991,772", "991,794,000",
"991,798,000", "991,847", "991,849", "991,879", "991,894",
"991,903,000", "991,940,000", "991,972", "991,974,000", "991,994",
"991,996,000", "992", "992,000", "992,042", "992,056", "992,057",
"992,069", "992,083", "992,089,000", "992,096", "992,097,000",
"992,105,000", "992,108", "992,119", "992,127,000", "992,130",
"992,135", "992,167", "992,177,000", "992,187", "992,244",
"992,256", "992,283", "992,287,000", "992,328", "992,383,000",
"992,431,000", "992,476", "992,514,000", "992,526", "992,535,000",
"992,550", "992,574", "992,591", "992,611", "992,613,000",
"992,616", "992,660", "992,665", "992,690", "992,691", "992,764",
"992,764,000", "992,830", "992,883", "992,890", "992,928",
"992,948", "992,989", "992,996", "993", "993,000", "993,005,000",
"993,010,000", "993,018", "993,026", "993,057", "993,076,000",
"993,090", "993,105", "993,199,000", "993,214", "993,245",
"993,302", "993,325", "993,327", "993,330,000", "993,332",
"993,373,000", "993,383", "993,418", "993,476", "993,476,977",
"993,481,000", "993,504,000", "993,518", "993,558", "993,560",
"993,564", "993,586", "993,595,000", "993,601,000", "993,616",
"993,632", "993,654", "993,658", "993,723", "993,832", "993,872,000",
"993,892", "993,929", "993,944,000", "993,949", "993,967",
"993,970", "994", "994,000", "994,038", "994,052", "994,059,000",
"994,087", "994,088", "994,103,000", "994,120", "994,220",
"994,245", "994,336", "994,339", "994,339,000", "994,415",
"994,420", "994,430", "994,446", "994,463", "994,469", "994,494",
"994,513", "994,536,000", "994,566", "994,582", "994,626",
"994,666", "994,710", "994,722", "994,736", "994,772,000",
"994,775", "994,810,000", "994,819,000", "994,840", "994,844,000",
"994,846,000", "994,861", "994,864", "994,898", "994,905",
"994,910,000", "994,913", "994,918", "994,967", "994,985",
"994,987", "995", "995,000", "995,017", "995,031", "995,043",
"995,059,000", "995,088", "995,163", "995,194", "995,205",
"995,216", "995,221", "995,267", "995,328", "995,371", "995,440",
"995,474", "995,476,000", "995,508", "995,540", "995,632",
"995,653,000", "995,660", "995,689", "995,712", "995,722",
"995,760", "995,762,000", "995,769", "995,793", "995,822",
"995,829", "995,831", "995,839,000", "995,895,000", "995,918",
"995,923", "995,955", "995,969", "995,980", "996", "996,000",
"996,004", "996,030", "996,117", "996,201", "996,240", "996,241",
"996,248,000", "996,312", "996,314,000", "996,348", "996,358",
"996,367", "996,380", "996,426", "996,446", "996,448,000",
"996,465", "996,487", "996,495,000", "996,510", "996,510,000",
"996,511", "996,556,000", "996,558", "996,613", "996,618",
"996,630", "996,676,000", "996,706", "996,732,000", "996,756,000",
"996,811", "996,826", "996,843,000", "996,920", "996,927",
"996,936", "996,962", "996,981,000", "996,988", "997", "997,000",
"997,010,000", "997,041", "997,061", "997,077", "997,084",
"997,108", "997,115", "997,134,000", "997,141", "997,168",
"997,254", "997,361", "997,380,000", "997,382", "997,401,000",
"997,423,000", "997,446", "997,457", "997,465", "997,470,000",
"997,477", "997,490", "997,490,000", "997,500", "997,539",
"997,542,000", "997,634", "997,649", "997,700", "997,722",
"997,728,000", "997,735", "997,753", "997,773,000", "997,785",
"997,786", "997,839", "997,874", "997,905", "997,911", "997,912",
"997,915", "997,920", "997,958", "997,961", "998", "998,000",
"998,048", "998,115", "998,173", "998,181", "998,189,000",
"998,208", "998,227", "998,262", "998,286", "998,298", "998,315,000",
"998,320", "998,369", "998,371", "998,484", "998,487", "998,511",
"998,532,000", "998,567", "998,579", "998,589,000", "998,608,000",
"998,618", "998,624", "998,664,000", "998,707,000", "998,709",
"998,713,000", "998,729", "998,735", "998,751", "998,766",
"998,800,000", "998,815", "998,818", "998,833", "998,858",
"998,868,000", "998,873", "998,877,000", "998,885", "998,886,000",
"998,888", "998,899", "998,947", "998,958", "998,964,000",
"998,992", "998,998,000", "999", "999,000", "999,022", "999,088,000",
"999,093", "999,098", "999,104", "999,133,000", "999,142",
"999,164", "999,191", "999,216,000", "999,227", "999,231,000",
"999,382,000", "999,396", "999,407", "999,416,000", "999,435,000",
"999,493,000", "999,554,000", "999,569,000", "999,578", "999,610",
"999,694", "999,698", "999,707", "999,709", "999,738", "999,790,000",
"999,802", "999,805", "999,815", "999,830", "999,852", "999,895",
"999,927", "999,975,000"), class = "factor"), county_fips_code = "99NULL"), row.names = 1L, class = "data.frame")
This df is a subset of an even larger dataset I initially read in from a .txt file using read.delim()
Any ideas whats going on?