converting to numeric

Hi,

As this is for an assignment, we can give you tips and pointers but no solutions.

So my tip is to use some simple regular expressions to extract the numbers you need from the columns and convert them to numeric values.

Here is an example using regex that's not extracting numbers, but text from a string containing other symbols

library(tidyverse)

myData = data.frame(
  col1 = c("#test!", "#hello@", "text()")
)

myData$col1 = str_extract(myData$col1, "\\w+")
myData
#>    col1
#> 1  test
#> 2 hello
#> 3  text

Created on 2022-02-14 by the reprex package (v2.0.1)

You can use similar regular expressions to extract the numbers you need. Here is a great way to get started:

Just one more tip: When writing regex in string format, you need to add another \ to escape \ used in regex patterns: so the \w used in the example is \\w in the string.

Good luck