Displaying 2 results from an estimated 2 matches for "fname4".
Did you mean:
fname
2017 Jul 14
0
Help with R script
...io 2. I used spread and
gather for that.
An alternative 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", 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 <-