search for: 98951

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

Did you mean: 9895
2017 Sep 08
5
Optimize code to read text-file with digits
...4673 54876 80959 09117 39292 74945 00001 37542 04805 64894 74296 24805 24037 20636 10402 00822 91665 00002 08422 68953 19645 09303 23209 02560 15953 34764 35080 33606 00003 99019 02529 09376 70715 38311 31165 88676 74397 04436 27659 00004 12807 99970 80157 36147 64032 36653 98951 16877 12171 76833 My program which is slow looks like this: filename <- "digits.txt" lines <- readLines(filename) numbers <- vector('numeric') for (i in 1:length(lines)) { # remove first column lines[i] <- sub("[^ ]+ +","",lines[i])...
2017 Sep 08
0
Optimize code to read text-file with digits
...117 39292 74945 > 00001 37542 04805 64894 74296 24805 24037 20636 10402 00822 91665 > 00002 08422 68953 19645 09303 23209 02560 15953 34764 35080 33606 > 00003 99019 02529 09376 70715 38311 31165 88676 74397 04436 27659 > 00004 12807 99970 80157 36147 64032 36653 98951 16877 12171 76833 > > My program which is slow looks like this: > > filename <- "digits.txt" > lines <- readLines(filename) > > numbers <- vector('numeric') > for (i in 1:length(lines)) { > > # remove first column > lines[i] &lt...
2017 Sep 08
0
Optimize code to read text-file with digits
...117 39292 74945 > 00001 37542 04805 64894 74296 24805 24037 20636 10402 00822 91665 > 00002 08422 68953 19645 09303 23209 02560 15953 34764 35080 33606 > 00003 99019 02529 09376 70715 38311 31165 88676 74397 04436 27659 > 00004 12807 99970 80157 36147 64032 36653 98951 16877 12171 76833 > > My program which is slow looks like this: > > filename <- "digits.txt" > lines <- readLines(filename) why you do not read a file as a whole e.g. by lines<-read.table("digits.txt") After that you do not need for cycle (but maybe I...