search for: newtst_new

Displaying 2 results from an estimated 2 matches for "newtst_new".

2017 Jul 14
0
Help with R script
...ternative solution to insert mising Fval - picking up with Don's newtst - is newtst <- c("FName: fname1", "Fval: Fval1.name1", "FName: fname2", "Fval: Fval2.name2", "FName: fname3", "FName: fname4", "Fval: fval4.fname4") newtst_new <- vector(mode = "character", length = sum(grepl("FName", newtst)) * 2) newtst_len <- length(newtst) i <- 1 j <- 1 while(i <= newtst_len){ if(grepl("FName", newtst[i]) & grepl("Fval", newtst[i + 1])){ newtst_new[c(j, j + 1)] <- new...
2017 Jul 13
2
Help with R script
Using Ulrik?s example data (and assuming I understand what is wanted), here is what I would do: ex.dat <- c("FName: fname1", "Fval: Fval1.name1", "Fval: ", "FName: fname2", "Fval: Fval2.name2", "FName: fname3") tst <- data.frame(x = ex.dat, stringsAsFactors=FALSE) sp <- strsplit(tst$x, ':', fixed=TRUE) chk <-