I am trying to do a very simple task which is trivial in me for any other language, and I It can not be in R.
I want the first 3 parts of an IP. So, becomes 192.168.0.1
192.168.0
. How should I go about this?
I have tried the Reggae path ...
grep ('[0-9] + \\. [0-9]] + \\. [ 0-9] + \\. ',' 192.168.0.1 ', value = TRUE)
This gives me full IP address, though.
I have tried a function, after which I am missing more than the list of my IP ...
ip_start & lt; - function (ip) {if (is.na (ip) | IP == 'ip ==' '). Returns (no)} and {class = strutsplit (IP, '\\.') Returns (paste (section [[1]] [1], section [1]] [2], section [[1]] [ 3], sep = '.'))}}} Test & lt; - lapply (full_data $ ipad, ip_start)
This gives me ...
error in strsplit (IP, "\\."): Non-character argument
I can not understand why this would be the case. Only I have an IP address or a blank space.
Thoughts?
You just last .
could use more digits to change.
x P>
x
No comments:
Post a Comment