Add data attribute to 'li' element in WP Nav

Is it possible to add more data attributes to β€˜li’ tag in wordpress nav menu?
For example: li data-menuanchor="’.$slug.’" ? Can you help me with this, please?

Thank you for your support

Add the following above this line.

$item_html = str_replace('<li', '<li data-menuanchor="' . sanitize_title($item->title)  . '"', $item_html);

Thank you very much, works like a charm.
Thumbs up for such a quick response and support.