exclude na - please help from someone just starting

I don't think so, it is hard to help you with this without a reproducible example, can you try to make one for this new issue?

ok, tried to run a more ample reproducible example and got a huge chunck of data that shows an attempt tp map health risk groups. I apologize for posting such an ample chunk, but I think it might help understand how the data is structured ...

Label = c("Yes", "No"
), class = "factor"), mistrhlp = structure(c(1L, 2L, 1L,
1L, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA), .Label = c("Agree strongly",
"Agree slightly", "Neither agree nor disagree", "Disagree slightly",
"Disagree strongly"), class = "factor"), misphlpf = structure(c(4L,
4L, 1L, 4L, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA), .Label = c("Agree strongly",
"Agree slightly", "Neither agree nor disagree", "Disagree slightly",
"Disagree strongly"), class = "factor"), scntmony = structure(c(5L,
5L, 5L, 5L, 5L, 5L, 5L, 4L, 5L, 5L, 1L, 3L, 5L, 3L, 5L, 5L,
1L, 5L, 3L, 3L, 5L, 5L, 4L, 4L, 5L, 5L, 2L, 4L, 5L, 5L, 5L,
2L, 5L, 4L, 5L, NA, 5L, 5L, 5L, 5L), .Label = c("Always",
"Usually", "Sometimes", "Rarely", "Never"), class = "factor"),
scntmeal = structure(c(5L, 5L, 5L, 5L, 5L, 5L, 4L, 4L, 5L,
5L, 4L, 1L, 5L, 5L, 5L, 5L, 3L, 5L, 4L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 4L, 2L, 5L, 5L, 5L, 5L, 5L, 4L, 5L, NA, 5L, 5L, 5L,
5L), .Label = c("Always", "Usually", "Sometimes", "Rarely",
"Never"), class = "factor"), scntpaid = structure(c(NA, 2L,
2L, NA, NA, 1L, 2L, NA, NA, NA, 2L, NA, NA, NA, NA, NA, 2L,
1L, 2L, NA, NA, NA, 1L, NA, NA, NA, NA, NA, 2L, 2L, NA, 2L,
2L, 2L, 2L, NA, NA, NA, NA, 3L), .Label = c("Paid by salary",
"Paid by the hour", "Paid by the job / task", "Paid some other way"
), class = "factor"), scntwrk1 = c(NA, 35L, 40L, NA, NA,
40L, 40L, NA, NA, NA, 70L, NA, NA, NA, NA, NA, 8L, 40L, 40L,
NA, NA, NA, 48L, NA, NA, NA, NA, NA, 40L, 45L, NA, 30L, 48L,
45L, 40L, NA, NA, NA, NA, 50L), scntlpad = structure(c(1L,
NA, NA, 1L, 3L, NA, NA, 1L, 1L, NA, NA, 1L, 2L, 1L, NA, 1L,
NA, NA, NA, 1L, 1L, 1L, NA, 2L, 2L, NA, 2L, 1L, NA, NA, 1L,
NA, NA, NA, NA, NA, 2L, 1L, 1L, NA), .Label = c("Paid by salary",
"Paid by the hour", "Paid by the job / task", "Paid some other way"
), class = "factor"), scntlwk1 = c(NA, NA, NA, 60L, 60L,
NA, NA, 40L, 50L, NA, NA, 40L, 40L, NA, NA, 35L, NA, NA,
NA, 60L, 40L, 12L, NA, 20L, NA, NA, 36L, 40L, NA, NA, 45L,
NA, NA, NA, NA, NA, 40L, 40L, 48L, NA), scntvot1 = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L,
2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, NA,
1L, 1L, 1L, 1L, NA, 1L, 1L, 1L, 1L), .Label = c("Yes", "No"
), class = "factor"), rcsgendr = structure(c(NA, 2L, NA,
NA, NA, NA, 1L, NA, 2L, NA, 2L, NA, NA, NA, NA, NA, 2L, NA,
1L, NA, NA, NA, 2L, NA, NA, NA, NA, NA, NA, NA, NA, 2L, NA,
NA, NA, NA, NA, NA, NA, NA), .Label = c("Boy", "Girl"), class = "factor"),
rcsrltn2 = structure(c(NA, 1L, NA, NA, NA, NA, 1L, NA, 3L,
NA, 1L, NA, NA, NA, NA, NA, 1L, NA, 1L, NA, NA, NA, 1L, NA,
NA, NA, NA, NA, NA, NA, NA, 1L, NA, NA, NA, NA, NA, NA, NA,
NA), .Label = c("Parent", "Grandparent", "Foster parent or guardian",
"Sibling", "Other relative", "Not related in any way"), class = "factor"),
casthdx2 = structure(c(NA, 2L, NA, NA, NA, NA, 2L, NA, 2L,
NA, 2L, NA, NA, NA, NA, NA, 2L, NA, 2L, NA, NA, NA, 2L, NA,
NA, NA, NA, NA, NA, NA, NA, 2L, NA, NA, NA, NA, NA, NA, NA,
NA), .Label = c("Yes", "No"), class = "factor"), casthno2 = structure(c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_), .Label = c("Yes",
"No"), class = "factor"), emtsuprt = structure(c(1L, 3L,
2L, 2L, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA), .Label = c("Always", "Usually",
"Sometimes", "Rarely", "Never"), class = "factor"), lsatisfy = structure(c(1L,
2L, 1L, 1L, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA), .Label = c("Very satisfied",
"Satisfied", "Dissatisfied", "Very dissatisfied"), class = "factor"),
ctelnum1 = structure(c(NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_), .Label = c("Yes", "7"), class = "factor"),
cellfon2 = structure(c(NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_), .Label = c("Yes", "No"), class = "factor"),
cadult = structure(c(NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_), .Label = c("Yes, male respondent",
"Yes, female respondent"), class = "factor"), pvtresd2 = structure(c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_), .Label = c("Yes",
"No"), class = "factor"), cclghous = structure(c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_), .Label = c("Yes",
"No"), class = "factor"), cstate = structure(c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_), .Label = c("Yes",
"No"), class = "factor"), landline = structure(c(NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_), .Label = c("Yes",
"No"), class = "factor"), pctcell = c(NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_, NA_real_, NA_real_,
NA_real_, NA_real_), qstver = structure(c(1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L), .Label = c("Only Version Landline",
"Version 1 Landline", "Version 2 Landline", "Version 3 Landline",
"Only Version Cell Phone", "Version 1 Cell Phone", "Version 2 Cell Phone",
"Version 3 Cell Phone"), class = "factor"), qstlang = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("English",
"Spanish", "Other"), class = "factor"), mscode = structure(c(3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 1L, 3L, 3L, 3L, 1L, 3L, 3L,
1L, 3L, 5L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 5L, 5L, 3L, 3L, 3L, 3L, 3L), .Label = c("In the center city of an MSA",
"Outside the center city of an MSA but inside the county containing the center city",
"Inside a suburban county of the MSA", "In an MSA that has no center city",
"Not in an MSA"), class = "factor"), X_ststr = c(11081L,
11081L, 11081L, 11081L, 11082L, 11081L, 11081L, 11081L, 11051L,
11051L, 11081L, 11081L, 11081L, 11081L, 11081L, 11081L, 11081L,
11082L, 11071L, 11081L, 11081L, 11081L, 11082L, 11051L, 11081L,
11081L, 11081L, 11081L, 11082L, 11081L, 11081L, 11081L, 11081L,
11071L, 11071L, 11081L, 11081L, 11081L, 11081L, 11081L),
X_strwt = c(40.197675, 40.197675, 40.197675, 40.197675, 60.3191839,
40.197675, 40.197675, 40.197675, 32.2130886, 32.2130886,
40.197675, 40.197675, 40.197675, 40.197675, 40.197675, 40.197675,
40.197675, 60.3191839, 13.6160371, 40.197675, 40.197675,
40.197675, 60.3191839, 32.2130886, 40.197675, 40.197675,
40.197675, 40.197675, 60.3191839, 40.197675, 40.197675, 40.197675,
40.197675, 13.6160371, 13.6160371, 40.197675, 40.197675,
40.197675, 40.197675, 40.197675), X_rawrake = c(1, 2, 3,
2, 2, 1, 2, 1, 5, 2, 1, 2, 1, 2, 0.66666667, 0.5, 1, 1, 2,
3, 2, 2, 2, 2, 1, 4, 2, 2, 1, 1, 2, 2, 1, 2, 2, 2, 1, 3,
1, 2), X_wt2rake = c(40.197675, 80.3953501, 120.593025, 80.3953501,
120.638368, 40.197675, 80.3953501, 40.197675, 161.065443,
64.4261772, 40.197675, 80.3953501, 40.197675, 80.3953501,
26.79845, 20.0988375, 40.197675, 60.3191839, 27.2320742,
120.593025, 80.3953501, 80.3953501, 120.638368, 64.4261772,
40.197675, 160.7907, 80.3953501, 80.3953501, 60.3191839,
40.197675, 80.3953501, 80.3953501, 40.197675, 27.2320742,
27.2320742, 80.3953501, 40.197675, 120.593025, 40.197675,
80.3953501), X_imprace = structure(c(2L, 1L, 1L, 1L, 1L,
2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L,
1L, 1L, 1L, 1L, 1L), .Label = c("White, Non-Hispanic", "Black, Non-Hispanic",
"Asian, Non-Hispanic", "American Indian/Alaskan Native, Non-Hispanic",
"Hispanic", "Other race, Non-Hispanic"), class = "factor"),
X_impnph = structure(c(2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 3L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L), .Label = c("1", "2", "3", "4", "5", "6"), class = "factor"),
X_impeduc = c(NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_), X_impmrtl = c(NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_), X_imphome = c(NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_,
NA_integer_, NA_integer_, NA_integer_), X_chispnc = structure(c(NA,
2L, NA, NA, NA, NA, 2L, NA, 2L, NA, 2L, NA, NA, NA, NA, NA,
2L, NA, 2L, NA, NA, NA, 2L, NA, NA, NA, NA, NA, NA, NA, NA,
2L, NA, NA, NA, NA, NA, NA, NA, NA), .
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"
), class = "factor"), X_asthms1 = structure(c(1L, 3L, 3L,
3L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 1L, 3L, 3L,
3L, 3L, 2L, 3L, 3L, 3L, 3L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L), .Label = c("Current", "Former",
"Never"), class = "factor"), X_drdxar1 = structure(c(1L,
2L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 2L, 2L, 1L,
2L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 1L,
1L, 2L, 2L, 2L, 1L, 1L, 2L, 1L, 2L), .Label = c("Diagnosed with arthritis",
"Not diagnosed with arthritis"), class = "factor"), X_prace1 = structure(c(2L,
1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L), .Label = c("White",
"Black or African American", "American Indian or Alaskan Native",
"Asian", "Native Hawaiian or other Pacific Islander", "Other race",
"No preferred race", "Multiracial but preferred race not answered"
), class = "factor"), X_mrace1 = structure(c(2L, 1L, 1L,
1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
2L, 2L, 1L, 1L, 1L, 1L, 1L), .Label = c("White", "Black or African American",
"American Indian or Alaskan Native", "Asian", "Native Hawaiian or other Pacific Islander",
"Other race only", "Multiracial"), class = "factor"), X_hispanc = structure(c(2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("Hispanic, Latino/a, or Spanish origin",
"Not of Hispanic, Latino/a, or Spanish origin"), class = "factor"),
X_race = structure(c(2L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L,
1L), .Label = c("White only, non-Hispanic", "Black only, non-Hispanic",
"American Indian or Alaskan Native only, Non-Hispanic", "Asian only, non-Hispanic",
"Native Hawaiian or other Pacific Islander only, Non-Hispanic",
"Other race only, non-Hispanic", "Multiracial, non-Hispanic",
"Hispanic"), class = "factor"), X_raceg21 = structure(c(2L,
1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L), .Label = c("Non-Hispanic White",
"Non-White or Hispanic"), class = "factor"), X_racegr3 = structure(c(2L,
1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L), .Label = c("White only, Non-Hispanic",
"Black only, Non-Hispanic", "Other race only, Non-Hispanic",
"Multiracial, Non-Hispanic", "Hispanic"), class = "factor"),
X_race_g1 = structure(c(2L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L,
1L), .Label = c("White - Non-Hispanic", "Black - Non-Hispanic",
"Hispanic", "Other race only", "Non-Hispanic"), class = "factor"),
X_ageg5yr = structure(c(9L, 7L, 8L, 9L, 10L, 6L, 4L, 9L,
7L, 10L, 5L, 8L, 11L, 9L, 10L, 11L, 3L, 10L, 6L, 10L, 11L,
12L, 5L, 9L, 12L, 7L, 10L, 10L, 7L, 8L, 12L, 3L, 10L, 6L,
9L, 8L, 11L, 9L, 11L, 8L), .Label = c("Age 18 to 24", "Age 25 to 29",
"Age 30 to 34", "Age 35 to 39", "Age 40 to 44", "Age 45 to 49",
"Age 50 to 54", "Age 55 to 59", "Age 60 to 64", "Age 65 to 69",
"Age 70 to 74", "Age 75 to 79", "Age 80 or older"), class = "factor"),
X_age65yr = structure(c(1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L,
2L, 1L, 1L, 2L, 1L, 2L, 2L, 1L, 2L, 1L, 2L, 2L, 2L, 1L, 1L,
2L, 1L, 2L, 2L, 1L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 2L,
1L), .Label = c("Age 18 to 64", "Age 65 or older"), class = "factor"),
X_age_g = structure(c(5L, 4L, 5L, 5L, 6L, 4L, 3L, 5L, 4L,
6L, 3L, 5L, 6L, 5L, 6L, 6L, 2L, 6L, 4L, 6L, 6L, 6L, 3L, 5L,
6L, 4L, 6L, 6L, 4L, 5L, 6L, 2L, 6L, 4L, 5L, 5L, 6L, 5L, 6L,
5L), .Label = c("Age 18 to 24", "Age 25 to 34", "Age 35 to 44",
"Age 45 to 54", "Age 55 to 64", "Age 65 or older"), class = "factor"),
X_bmi5 = c(3916L, 1822L,
2746L, 2197L, 3594L, 3986L, 2070L, NA, 3017L, 2829L, 2968L,
2776L, 2067L, 2487L, 2976L, 3681L, 2114L, 2281L, 2835L, 2819L,
3090L, 2897L, 3206L, 2926L, 3023L, 3100L, 3157L, 3189L, 2923L,
2391L, 2789L, 2582L, 2281L, 3090L, 4024L, NA, 2884L, 4114L,
2912L, 3396L), X_bmi5cat = structure(c(4L, 1L, 3L, 2L, 4L,
4L, 2L, NA, 4L, 3L, 3L, 3L, 2L, 2L, 3L, 4L, 2L, 2L, 3L, 3L,
4L, 3L, 4L, 3L, 4L, 4L, 4L, 4L, 3L, 2L, 3L, 3L, 2L, 4L, 4L,
NA, 3L, 4L, 3L, 4L), .Label = c("Underweight", "Normal weight",
"Overweight", "Obese"), class = "factor"), X_rfbmi5 = structure(c(2L,
1L, 2L, 1L, 2L, 2L, 1L, NA, 2L, 2L, 2L, 2L, 1L, 1L, 2L, 2L,
1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L,
2L, 1L, 2L, 2L, NA, 2L, 2L, 2L, 2L), .Label = c("No", "Yes"
), class = "factor"), X_chldcnt = structure(c(1L, 3L, 1L,
1L, 1L, 1L, 2L, 1L, 2L, 1L, 4L, 1L, 1L, 1L, 1L, 1L, 2L, 1L,
2L, 1L, 1L, 1L, 3L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No children in household",
"One child in household", "Two children in household", "Three children in household",
"Four children in household", "Five or more children in household"
), class = "factor"), X_educag = structure(c(4L, 3L, 4L,
2L, 4L, 4L, 2L, 3L, 4L, 2L, 4L, 4L, 3L, 4L, 3L, 4L, 2L, 3L,
2L, 3L, 4L, 4L, 4L, 4L, 1L, 3L, 3L, 3L, 4L, 2L, 3L, 2L, 4L,
4L, 2L, 3L, 4L, 3L, 2L, 3L), .Label = c("Did not graduate high school",
"Graduated high school", "Attended college or technical school",
"Graduated from college or technical school"), class = "factor"),
X_incomg = structure(c(5L, 5L, 5L, 5L, 4L, 5L, NA, 4L, 5L,
2L, 5L, 1L, 5L, NA, NA, 5L, 2L, 5L, 5L, 2L, 4L, 5L, 5L, 5L,
1L, 5L, 5L, 2L, 5L, 5L, 2L, NA, 5L, 3L, 5L, NA, NA, 5L, NA,
5L), .Label = c("Less than $15,000", "$15,000 to less than $25,000",
"$25,000 to less than $35,000", "$35,000 to less than $50,000",
"$50,000 or more"), class = "factor"), X_smoker3 = structure(c(3L,
4L, 2L, 4L, 3L, 4L, 3L, 1L, 4L, 4L, 4L, 1L, 4L, 2L, 1L, 3L,
3L, 1L, 3L, 4L, 3L, 4L, 3L, 1L, 3L, 1L, 3L, 4L, 4L, 1L, 3L,
3L, 4L, 4L, 4L, 4L, 4L, 3L, 3L, 4L), .Label = c("Current smoker - now smokes every day",
"Current smoker - now smokes some days", "Former smoker",
"Never smoked"), class = "factor"), X_rfsmok3 = structure(c(1L,
1L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 2L, 2L, 1L,
1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 2L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("No", "Yes"
), class = "factor"), vegeda1_ = c(NA, 43L, 100L, 57L, 100L, 100L, 33L,
27L, 100L, 43L, 27L, 83L, 100L, 43L, 57L, 83L, 100L, 100L,
67L, 50L, 200L, 83L, 43L, 83L, 14L, 100L, 43L, 100L, 200L,
100L, 71L, 133L, 300L, 71L, 50L, NA, 100L, 43L, 100L, 83L
), X_misfrtn = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 1L, 2L,
1L, 1L), .Label = c("No missing fruit responses", "1 missing response",
"2 missing responses"), class = "factor"), X_misvegn = structure(c(2L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 5L, 1L, 1L, 1L, 1L), .Label = c("No missing vegetable responses",
"1 missing response", "2 missing responses", "3 missing responses",
"4 missing responses"), class = "factor"), X_frtresp = structure(c(2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 1L, 2L, 1L, 2L, 2L), .Label = c("Not Included - Missing Fruit Responses",
"Included - Missing Fruit Responses"), class = "factor"),
X_vegresp = structure(c(1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 2L,
2L), .Label = c("Not Included - Missing Fruit Responses",
"Included - Missing Fruit Responses"), class = "factor"),
X_frutsum = c(413, 20, 46, 49, 7, 157, 150, 67, 100, 58,
13, 414, 100, 14, 43, 100, 0, 50, 40, 100, 300, 150, 34,
17, 0, 200, 43, 100, 200, 100, 56, 100, 400, 600, 110, NA,
200, 43, 100, 113), X_vegesum = c(53, 148, 191, 136, 243,
143, 216, 360, 172, 114, 44, 282, 214, 186, 143, 200, 643,
167, 183, 166, 329, 163, 83, 166, 114, 307, 67, 187, 400,
157, 143, 236, 529, 571, 124, NA, 300, 129, 243, 283), X_frtlt1 = structure(c(1L,
2L, 2L, 2L, 2L, 1L, 1L, 2L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L,
2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 2L, 1L, 1L, 1L, 2L,
1L, 1L, 1L, 1L, NA, 1L, 2L, 1L, 1L), .Label = c("Consumed fruit one or more times per day",
"Consumed fruit less than one time per day"), class = "factor"),
X_veglt1 = structure(c(2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L,
1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, NA, 1L, 1L, 1L,
1L), .Label = c("Consumed vegetables one or more times per day",
"Consumed vegetables less than one time per day"), class = "factor"),
X_frt16 = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L), .Label = c("Not included - Values are too high", "Included - values are in accepted range"
), class = "factor"), X_veg23 = structure(c(2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L), .Label = c("Not included - Values are too high",
"Included - values are in accepted range"), class = "factor"),
X_fruitex = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 1L,
1L), .Label = c("No missing values and in accepted range",
"Missing fruit responses", "Fruit values out of range"), class = "factor"),
X_vegetex = structure(c(2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L,
1L), .Label = c("No missing values and in accepted range",
"Missing vegetables responses", "Vegetables values out of range"
), class = "factor"), X_totinda = structure(c(2L, 1L, 2L,
1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 2L,
2L, 1L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 2L, 1L,
1L, 2L, NA, 1L, 2L, 1L, 1L), , class = "factor"),
X_pacat1 = structure(c(4L, 3L, 4L, 3L, 4L, 3L, 2L, 3L, 2L,
2L, 1L, 4L, 4L, NA, 1L, 3L, 2L, 4L, 4L, 1L, 2L, 4L, 3L, 4L,
NA, 1L, 1L, 4L, 1L, 4L, 1L, 4L, 1L, 3L, 4L, NA, 3L, 4L, 3L,
1L), .Label = c("Highly active", "Active", "Insufficiently active",
"Inactive"), class = "factor"), X_paindx1 = structure(c(2L,
2L, 2L, 2L, 2L, 2L, 1L, 2L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 2L,
1L, 2L, 2L, 1L, 1L, 2L, 2L, 2L, NA, 1L, 1L, 2L, 1L, 2L, 1L,
2L, 1L, 2L, 2L, NA, 2L, 2L, 2L, 1L), .Label = c("Met aerobic recommendations",
"Did not meet aerobic recommendations"), class = "factor"),
X_pa150r2 = structure(c(3L, 2L, 3L, 2L, 3L, 2L, 1L, 2L, 1L,
1L, 1L, 3L, 3L, 1L, 1L, 2L, 1L, 3L, 3L, 1L, 1L, 3L, 2L, 3L,
NA, 1L, 1L, 3L, 1L, 3L, 1L, 3L, 1L, 2L, 3L, NA, 2L, 3L, 2L,
1L), .Label = c("150+ minutes", "1-149 minutes", "0 minutes"
), class = "factor"), X_pa300r2 = structure(c(3L, 2L, 3L,
2L, 3L, 2L, 2L, 2L, 2L, 2L, 1L, 3L, 3L, NA, 1L, 2L, 2L, 3L,
3L, 1L, 2L, 3L, 2L, 3L, NA, 1L, 1L, 3L, 1L, 3L, 1L, 3L, 1L,
2L, 3L, NA, 2L, 3L, 2L, 1L), .Label = c("301+ minutes", "1-300 minutes",
"0 minutes"), class = "factor"), X_pa30021 = structure(c(2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, NA, 1L, 2L,
2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, NA, 1L, 1L, 2L, 1L, 2L, 1L,
2L, 1L, 2L, 2L, NA, 2L, 2L, 2L, 1L), .Label = c("301+ minute",
"0-300 minutes"), class = "factor"), X_pastrng = structure(c(2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 1L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L,
2L, 2L, 2L, 2L, NA, 2L, 2L, 2L, 1L), .Label = c("Met muscle strengthening recommendations",
"Did not meet muscle strengthening recommendations"), class = "factor"),
X_parec1 = structure(c(4L, 4L, 4L, 4L, 4L, 4L, 2L, 4L, 1L,
2L, 2L, 4L, 3L, 2L, 2L, 4L, 2L, 4L, 4L, 2L, 1L, 4L, 4L, 4L,
NA, 2L, 2L, 4L, 2L, 4L, 1L, 4L, 2L, 4L, 4L, NA, 4L, 4L, 4L,
1L), .Label = c("Met both guidelines", "Met aerobic guidelines only",
"Met strengthening guidelines only", "Did not meet either guideline"
), class = "factor"), X_pastae1 = structure(c(2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 1L, 2L, 2L, 2L, NA, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L,
2L, 2L, NA, 2L, 2L, 2L, 1L), .Label = c("Met both guidelines",
"Did not meet both guidelines"), class = "factor"), X_lmtact1 = structure(c(1L,
3L, 1L, 3L, 3L, 3L, 2L, 1L, 2L, 3L, 3L, 1L, 3L, 3L, 3L, 1L,
3L, 3L, 3L, 3L, 2L, 2L, 3L, 3L, 3L, 3L, 1L, 1L, 2L, 3L, 2L,
2L, 3L, 3L, 3L, NA, 2L, 3L, 2L, 3L), .Label = c("Told have arthritis and have limited usual activities",
.Label = c("Told have arthritis and have limited work",
"Told have arthritis and no limited work", "Not told they have arthritis"
), class = "factor"), X_lmtscl1 = structure(c(1L, 4L, 2L,
4L, 4L, 4L, 3L, 1L, 3L, 4L, 4L, 1L, 4L, 4L, 4L, 3L, 4L, 4L,
4L, 4L, 3L, 3L, 4L, 4L, 4L, 4L, 2L, 2L, 3L, 4L, 3L, 3L, 4L,
4L, 4L, NA, 3L, 4L, 3L, 4L), .Label = c("Told have arthritis and social activities limited a lot",
"Told have arthritis and social activities limited a little",
"Told have arthritis and social activities not limited",
"Not told they have arthritis"), class = "factor"), X_rfseat2 = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, NA, 1L, 1L, 1L, 1L), .Label = c("Always or almost always wear seat belt",
"Sometimes, seldom, or never wear seat belt"), class = "factor"),
X_rfseat3 = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L,
1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, NA, 1L, 1L, 1L,
1L), .Label = c("Always wear seat belt", "Don't always wear seat belt"
), class = "factor"), class = "factor"),
class = "data.frame"), sex = structure(c(2L, 2L, 2L, 2L,
1L, 2L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 1L,
2L, 1L, 1L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L,
1L, 1L, 2L, 1L), .Label = c("Male", "Female"), class = "factor")), row.names = c(NA,
40L), class = "data.frame")

Sadly, this is not useful, since it is not even complete, and it doesn't include any relevant code, please go through the guide again and try to make a proper reprex.

head(brfss2013, 100)[, c('genhlth', 'sex')]
genhlth sex
1 Fair Female
2 Good Female
3 Good Female
4 Very good Female
5 Good Male
6 Very good Female
7 Fair Female
8 Good Female
9 Excellent Male
10 Good Female
11 Good Male
12 Fair Male
13 Fair Female
14 Good Female
15 Very good Male
16 Fair Female
17 Fair Female
18 Very good Female
19 Good Female
20 Excellent Male
21 Very good Female
22 Very good Male
23 Very good Male
24 Very good Female
25 Good Female
26 Excellent Female
27 Good Male
28 Poor Female
29 Very good Female
30 Very good Female
31 Fair Male
32 Excellent Female
33 Excellent Female
34 Good Female
35 Fair Female
36 Good Female
37 Good Male
38 Good Male
39 Good Female
40 Good Male
41 Excellent Female
42 Good Female
43 Poor Female
44 Good Female
45 Fair Male
46 Good Female
47 Good Male
48 Good Female
49 Excellent Male
50 Excellent Male
51 Good Female
52 Very good Female
53 Excellent Male
54 Very good Male
55 Very good Female
56 Poor Female
57 Good Male
58 Good Male
59 Excellent Male
60 Good Male
61 Fair Female
62 Very good Female
63 Poor Female
64 Very good Male
65 Good Female
66 Very good Male
67 Good Male
68 Very good Male
69 Fair Female
70 Poor Male
71 Good Female
72 Excellent Female
73 Poor Male
74 Very good Female
75 Poor Female
76 Fair Male
77 Very good Female
78 Very good Female
79 Excellent Female
80 Very good Female
81 Good Female
82 Good Female
83 Poor Female
84 Good Male
85 Very good Female
86 Fair Male
87 Very good Male
88 Fair Male
89 Fair Male
90 Good Male
91 Poor Female
92 Excellent Male
93 Very good Female
94 Very good Female
95 Good Female
96 Good Female
97 Fair Female
98 Good Female
99 Fair Female
100 Fair Male

Sorry but that is not reproducible nor copy/paste friendly, and even if it would, you are just posting sample data, you have to also include the code that is producing the error message and put all together into a self-contained reproducible example.
Read the guide more carefully and try again

datapasta::df_paste(head(brfss2013, 20)[, c('genhlth', 'sex')])

data.frame(

  •  genhlth = as.factor(c("Fair","Good","Good",
    
  •                        "Very good","Good","Very good","Fair","Good",
    
  •                        "Excellent","Good","Good","Fair","Fair","Good",
    
  •                        "Very good","Fair","Fair","Very good","Good",
    
  •                        "Excellent")),
    
  •      sex = as.factor(c("Female","Female",
    
  •                        "Female","Female","Male","Female","Female","Female",
    
  •                        "Male","Female","Male","Male","Female",
    
  •                        "Female","Male","Female","Female","Female","Female",
    
  •                        "Male"))
    
  • )
    genhlth sex
    1 Fair Female
    2 Good Female
    3 Good Female
    4 Very good Female
    5 Good Male
    6 Very good Female
    7 Fair Female
    8 Good Female
    9 Excellent Male
    10 Good Female
    11 Good Male
    12 Fair Male
    13 Fair Female
    14 Good Female
    15 Very good Male
    16 Fair Female
    17 Fair Female
    18 Very good Female
    19 Good Female
    20 Excellent Male

ggplot(brfss2013, mapping = aes(x = genhlth)) + geom_col(aes(fill = sex), position = "dodge") + scale_fill_manual(values = c("Female" = "springgreen", "Male" = "chocolate"))
Erro: geom_col requires the following missing aesthetics: y
Run rlang::last_error() to see where the error occurred.

Also, the system gives this error and asks to run the for_cats_na cde, which I did(for no use)

brfss2013%>%count(genhlth, sex)%>% ggplot(brfss2013, mapping = aes(x = smoke100)) + geom_bar(aes(fill = sex), position = "dodge")+ scale_fill_hue()+theme_minimal()
Error in FUN(X[[i]], ...) : objeto 'smoke100' não encontrado
Além disso: Warning messages:
1: Factor genhlth contains implicit NA, consider using forcats::fct_explicit_na
2: Factor sex contains implicit NA, consider using forcats::fct_explicit_na

brfss2013_explicit_na <- brfss2013%>%forcats::fct_explicit_na
Error in .::forcats : unused argument (fct_explicit_na)
forcats::fct_explicit_na
function (f, na_level = "(Missing)")
{
f <- check_factor(f)
is_missing <- is.na(f)
is_missing_level <- is.na(levels(f))
if (any(is_missing)) {
f <- fct_expand(f, na_level)
f[is_missing] <- na_level
f
}
else if (any(is_missing_level)) {
levs <- levels(f)
levs[is.na(levs)] <- na_level
lvls_revalue(f, levs)
}
else {
f
}
}

This error message is self explanatory, you haven't map a variable to the y aesthetic and geom_col requires one, that is why in my example I used the count() function and maped y = n

This is also self explanatory, there is no variable called "smoke100" in your dataframe and you are trying to map the x aesthetic to a non existing variable.

Thanks again. I'm trying to fix the error, but stil no success...

brfss2013%>%fct_explicit_na(brfss2013$genhlth, na_level = "(Missing)")%>%count(genhlth, sex)%>%ggplot(brfss2013, mapping = aes(x = genhlth)) + geom_bar(aes(fill = sex), position = "dodge") + scale_fill_hue() + theme_minimal()
Error in fct_explicit_na(., brfss2013$genhlth, na_level = "(Missing)") :
unused argument (brfss2013$genhlth)

Sorry Curtis, I guess I misunderstood you question...

Couldn't edit the title (tried), I don't think the system allows it.

Andres was kind enough to teach me (patiently) how to do a reprex. So I guess it is in the post above? Or is it incorrect?

Sadly, nothing of what you have posted so far is reproducible or even copy/paste friendly, can you read the guide one more time and try again? as a reference, a reproducible example should look like the one in this post

Ok, I don't know how to do a reproducible example of metadata with 330 columns and 491,000 lines.

With a subset of those 330 columns and 491,000 lines. In your code you are using only 2 variables not 330 and we only need a few rows, not all of them.

The thing is that providing a reprex is not mandatory but greatly increases your chances of getting help so the longer you take to make one, the longer would take to get the help you need.

Ok. Let's see if that helps you a little.

dput(head(brfss2013, 15)[c("genhlth", "sex")])
structure(list(genhlth = structure(c(4L, 3L, 3L, 2L, 3L, 2L,
4L, 3L, 1L, 3L, 3L, 4L, 4L, 3L, 2L), .Label = c("Excellent",
"Very good", "Good", "Fair", "Poor"), class = "factor"), sex = structure(c(2L,
2L, 2L, 2L, 1L, 2L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 1L), .Label = c("Male",
"Female"), class = "factor")), row.names = c(NA, 15L), class = "data.frame")

df <- data.frame(stringsAsFactors = FALSE, genhlth= c("Excellent", "Very good", "Good", "Fair", "Poor"), sex = c("Female", "Male"))
Error in data.frame(stringsAsFactors = FALSE, genhlth = c("Excellent", :
arguments imply differing number of rows: 5, 2
sex.genhlth <- brfss2013%>%filter(!is.na(sex))%>%group_by(genhlth, sex)%>%summarise(mean = mean(genhlth))%>% ggplot(brfss2013, mapping = aes(x = genhlth)) + geom_col(aes(fill = sex), position = "dodge")
There were 13 warnings (use warnings() to see them)
warnings()
Mensagens de aviso:
1: Factor genhlth contains implicit NA, consider using forcats::fct_explicit_na
2: In mean.default(genhlth) : argument is not numeric or logical: returning NA
3: In mean.default(genhlth) : argument is not numeric or logical: returning NA
4: In mean.default(genhlth) : argument is not numeric or logical: returning NA
5: In mean.default(genhlth) : argument is not numeric or logical: returning NA
6: In mean.default(genhlth) : argument is not numeric or logical: returning NA
7: In mean.default(genhlth) : argument is not numeric or logical: returning NA
8: In mean.default(genhlth) : argument is not numeric or logical: returning NA
9: In mean.default(genhlth) : argument is not numeric or logical: returning NA
10: In mean.default(genhlth) : argument is not numeric or logical: returning NA
11: In mean.default(genhlth) : argument is not numeric or logical: returning NA
12: In mean.default(genhlth) : argument is not numeric or logical: returning NA
13: In mean.default(genhlth) : argument is not numeric or logical: returning NA

Something else:
Here's a perfect assignment using the same data:

https://coursera-assessments.s3.amazonaws.com/assessments/1558620775295/10361695-2f16-4265-b59e-2c96b8b67d5e/intro_data_prob_project.html

This is becoming very frustrating, you post different code each time but your code doesn't seem to make any sense, in this particular case you are trying to calculate the mean of a categorical variable, which is not possible, What the mean of ("Excellent",
"Very good", "Good", "Fair", "Poor") would be? This issue is not about coding, you need to check your logic first.

This is not the best place to teach you R from zero so I have shared with you via DM a more suitable learning resource.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.