search for: alldatk

Displaying 3 results from an estimated 3 matches for "alldatk".

Did you mean: alldata
2016 Apr 09
3
assign
Hi all I am trying t extract a variable from a column ASk/20005-01-45/90 Alldatk/25-17-4567/990 I want to assign a variable to the numbers coming the first"-" x=01 for the first and x=17 for teh second I tried using gsub but did not work x=gsub("-") any help? [[alternative HTML version deleted]]
2016 Apr 09
1
assign
Hi, I couldn't resist these two suggestions: strings <- c("ASk/20005-01-45/90", "Alldatk/25-17-4567/990") x <- as.numeric(gsub("^[^-]*-|-.*$","",strings)) or x <- as.numeric(sub("^[^-]*-([0-9]+)-.*$","\\1",strings)) Best, Georges --------------------- Georges Monette, York University, Toronto On 08/04/2016 10:53 PM, Fox, John wro...
2016 Apr 09
0
assign
Dear Val, Your question isn't entirely clear (to me), but this is what I think you want to do: ------------------ snip ---------------- > strings <- c("ASk/20005-01-45/90", "Alldatk/25-17-4567/990") > location <- regexpr("-[0-9]*", strings) > x [1] "01" "17" > x <- substring(strings, location + 1, location + attr(location, "match.length") - 1) > as.numeric(x) [1] 1 17 ------------------ snip ---------------- I h...