Return the number of decimals nchar(strsplit(as.character(5.230000), "\\.")[[1]][2]) [1] 2 nchar(strsplit(as.character(5.230200), "\\.")[[1]][2])
Remove part of strings after occurrence of a character Remove part of strings after “.” a <- c("NM_020506.1", "NM_020519.1", "NM_001030297.2", "NM_010281.2", "NM_011419.3", "NM_053155.2") gsub("\\..*","",a) [1] "NM_020506" "NM_020519" "NM_001030297" "NM_010281" "NM_011419" "NM_053155"
match example A sample data: (target <- c("b", "c", "a", "d")) (df <- data.frame(name=letters[1:4], value=c(rep(TRUE, 2), rep(FALSE, 2))))
List files in a directory and subdirectories List files matching the pattern in all subdirectories list.files(pattern = "_input.txt$", recursive = TRUE)
Count missing values row-wise A sample data: (data = data.frame(x=c(NA,NA,3:10), y=11:20, z=c(21,NA,23:30))) x y z