I have a data.frame
test_data <- read.csv("https://stepik.org/media/attachments/course/724/test_data_01.csv", 
                       stringsAsFactors = FALSE)
This data.frame looks like this:
 V1      V2       V3      V4       V5
1 -2. 5935    II 2   0.4984 ST 123E -2.154 4
2  -0.2888 ST 123E   1.5636 ST 123E   0.1053
3 -0.828 6 ST 123E -0.9 791  HP 129 -0. 4989
4  -0. 322 ST 123E  -0.3013  HP 129  -0.4032
5  -0.5588 ST 123E   1.2694  HP 129  0.703 9
My goals: 1) sort only real numeric (V1, V3, V5)
num_test<-test_data[sapply(test_data, function(x) grepl("[A-Za-z]", x, perl = T))==F]
2) in real numeric(V1, V3, V5) remove whitespaces and then change for V1, V3, V5 factor to numeric
str_remove_all(num_test," ")
But I don't understand how can I return data.frame with changes. It should look like this:
V1      V2      V3      V4      V5
1 -2.5935    II 2  0.4984 ST 123E -2.1544
2 -0.2888 ST 123E  1.5636 ST 123E  0.1053
3 -0.8286 ST 123E -0.9791  HP 129 -0.4989
4 -0.3220 ST 123E -0.3013  HP 129 -0.4032
5 -0.5588 ST 123E  1.2694  HP 129  0.7039
Thanks!
 
    