Certain url links and text does not wrap in Latex table while others do

multirowtables

I am attempting to recreate the following table using Latex:
enter image description here

In my attempt, however, I noticed that my table is oddly sized and certain URL's and texts do not wrap inside their cells while others do despite having the same commands. I am wondering how I can wrap these texts and compact the size of my table, even if the text size becomes smaller. Here is my attempt:

\begin{table}[H]
   \centering
   \small
   \begin{tabular}{|p{3cm}|p{3.5cm}|p{3.5cm}|p{3.5cm}|}
       \hline
       Data Type & Data Names & GIS attribute Names & Data Source \\
       \hline
       Home Value & Change Rates of Zillow Home Value Index (ZHVI) 2020-2021 & C5\_20\_21 & Zillow Research Data: \url{https://www.zillow. com/research/data/} \\
       \hline
       \multirow{2}*{COVID 19 Data} & Case Number of Covid 19 by June 30, 2021 & COVID & \multirow{2}*{USA Facts: \url{https://usafacts.org/visualizations/coronavirus-covid-19-spread-map}}\\
       \cline{2-3}
       & Covid 19 Rate by June 30, 2021 & COVID\_R & \\
       \hline
       \multirow{18}*{Population, Employment, Education, Poverty, \& Other socio-economic data} & Total Population & POP & \multirow{11}*{U.S. Census Bureau: \url{https://covid19.census.gov/search?collection=Dataset}}\\
       \cline{2-3}
       & POP\_DENSITY & POP\_DENSITY &\\
       \cline{2-3}
       & Percent of Households with income in the past 12 months that was less than \$75,000 & HOUSELT75KP &\\
       \cline{2-3}
       & Total Population - Worked at home & POP\_WORK\_HOME &\\
       \cline{2-3}
       & Percent of Civilian Employed Population 16 Years and Over in Healthcare Practitioners and Technical Occupations & HCTOCC\_CALC &\\
       \cline{2-3}
       & Average Household Size & HOUSEHOLD\_SIZE &\\
       \cline{2-3}
       & Total Civilian Noninstitutionalized Population - With health insurance coverage & POP\_INSUR &\\
       \cline{2-3}
       & Percent of Population with No Health Insurance Coverage & POP\_NO\_INSUR &\\
       \cline{2-3}
       & Percent of Households with Internet At Home & PER\_INTERNET &\\
       \cline{2-3}
       & Total Households with a computer & HH\_COMPUTER &\\
       \cline{2-3}
       & Total Households with a broadband Internet subscription & HH\_INTERNET &\\
       \cline{2-4}
       & Number employed annual average, 2020 & EMPLOYED & \multirow{7}*{U.S. Department of Agriculture: \url{https://www.ers.usda.gov/data-products/county-level-data-sets/download-data/}}\\
       \cline{2-3}
       & Bachelor's degree or higher, 2015-19 & BACHELOR &\\
       \cline{2-3}
       & Percent of adults with a bachelor's degree or higher, 2015-19 & PER\_BACHELOR &\\
       \cline{2-3}
       & Estimate of people of all ages in poverty 2019 & POVALL &\\
       \cline{2-3}
       & Estimate of median household income 2019 & MEDHHINC &\\
       \cline{2-3}
       & Numeric Change in resident total population 7/1/2018 to 7/1/2019 & N\_POP\_CHG &\\
       \cline{2-3}
       & Natural increase of population in period 7/1/2018 to 6/30/2019 & NATURAL\_IN &\\
       \hline
       \end{tabular}
    \end{table}

enter image description here

Best Answer

With use of xurl package and new table package tabularray this is simple to achieve. Later offer for multi row cells macro \SetCell[r=<number>]{<format>} which with conjunction of X column type enable to break long \url text.

Since table is quite huge, in table I use \small font size:

\documentclass{article}
\usepackage[margin=20mm]{geometry}
\usepackage{tabularray}
\usepackage{xurl}

\begin{document}
    \begin{table}
    \small
\begin{tblr}{% TABLE SPECIFICATION
    colspec={X[2,l] X[3,l]X[1.5,l]X[2,l]},
    hline{1,Z}={1pt}, hline{2}={0.7pt}, hline{3-Y},
    vlines,
             }
% TABLE BODY
Data Type 
    & Data Names
        & GIS attribute Names 
            & Data Source \\
Home Value 
    & Change Rates of Zillow Home Value Index (ZHVI) 2020-2021 
        & C5\_20\_21 
            & Zillow Research Data: \url{https://www.zillow. com/research/data/} \\

COVID 19 Data 
    & Case Number of Covid 19 by June 30, 2021 
        & COVID 
            & \SetCell[r=2]{h}Facts: \url{https://usafacts.org/visualizations/coronavirus-covid-19-spread-map}\\
   & Covid 19 Rate by June 30, 2021 & COVID\_R & \\
\SetCell[r=18]{h} Population, Employment, Education, Poverty, \& Other socio-economic data
    & Total Population 
        & POP 
            & \SetCell[r=11]{h} U.S. Census Bureau: \url{https://covid19.census.gov/search?collection=Dataset}\\
    & POP\_DENSITY 
        & POP\_DENSITY 
            &   \\
    & Percent of Households with income in the past 12 months that was less than \$75,000 
        & HOUSELT75KP 
            &   \\
    & Total Population - Worked at home 
        & POP\_WORK\_HOME 
            &   \\
    & Percent of Civilian Employed Population 16 Years and Over in Healthcare Practitioners and Technical Occupations
        & HCTOCC\_CALC 
            &   \\
     & Average Household Size 
        & HOUSEHOLD\_SIZE 
            &   \\
    & Total Civilian Noninstitutionalized Population - With health insurance coverage 
        & POP\_INSUR 
            &   \\
    & Percent of Population with No Health Insurance Coverage 
        & POP\_NO\_INSUR 
            &   \\
    & Percent of Households with Internet At Home 
        & PER\_INTERNET 
            &   \\
    & Total Households with a computer 
        & HH\_COMPUTER 
            &   \\
    & Total Households with a broadband Internet subscription
        & HH\_INTERNET 
            &   \\
    & Number employed annual average, 2020 
        & EMPLOYED 
            & \SetCell[r=7]{h} U.S. Department of Agriculture: \url{https://www.ers.usda.gov/data-products/county-level-data-sets/download-data/}  \\
    & Bachelor's degree or higher, 2015-19 
        & BACHELOR 
            &   \\
    & Percent of adults with a bachelor's degree or higher, 2015-19 
        & PER\_BACHELOR 
            &   \\
    & Estimate of people of all ages in poverty 2019 
        & POVALL 
            &   \\
    & Estimate of median household income 2019 
        & MEDHHINC 
            &   \\
    & Numeric Change in resident total population 7/1/2018 to 7/1/2019 
        & N\_POP\_CHG 
            &   \\
    & Natural increase of population in period 7/1/2018 to 6/30/2019 
        & NATURAL\_IN 
            &   \\
\end{tblr}
   \end{table}
\end{document}

enter image description here

Related Question