Posts by Kauê de Sousa • 71 points
3 posts
-
4
votes2
answers78
viewsA: Deleting columns containing NA s in their last 5 rows
One of the solutions would be: lims <- c(46, 50) keep <- lapply(df[1:ncol(df)], function(x) sum(is.na(x[lims[1]:lims[2]])) == 0 ) keep <- unlist(keep) df <- df[,keep] tail(df)…
ranswered Kauê de Sousa 71 -
3
votes3
answers1376
viewsA: Fill column of a data frame with data from another data frame in R
Here’s another example with a code that doesn’t use dependencies (only based on R). In its example, 456 is the same code used for YELLOW and BROWN. I created another code (457 for BROWN) to avoid…
-
-1
votes2
answers737
viewsA: How to replace a space by semicolon between two words with gsub()
Another simpler option would be: ex <- "[email protected] [email protected]" new_ex <- gsub(" ", ";", ex) new_ex