This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(plyr) | |
df.stacked <- rbind.fill(df1, df2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tibble) | |
df <- rownames_to_column(df, var = "id") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df$date_d1 <- as.character(as.Date(as.POSIXct((as.numeric(as.character(df$date_d1)) * 86400), origin = "1899-12-30", tz = "GMT"))) | |
# using janitor | |
janitor::excel_numeric_to_date(17933) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ht <- function(d) rbind(head(d,5), tail(d,5)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
perl -pe 's/NOTNEEDED\.\s*WORD(*SKIP)(*F)|WORD\./\n$&/g' | |
# SAMPLE | |
NOTNEEDED. WORD. 8 de 2007/04/12 excepción definitiva | |
1ª Concesión de derechos en Londres WORD. 3901 de 2019/10/01 UTC | |
# OUTPUT | |
NOTNEEDED. WORD. 8 de 2007/04/12 excepción definitiva |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sed -r 's/([^.] )(WORD\. )/\1\n\2/g' | |
# sample | |
NOTNEEDED. WORD. 8 de 2007/04/12 Definitiva | |
1ª Conferencia mundial en londres WORD. 3901 de 2009/10/01 UTC | |
# output | |
NOTNEEDED. WORD. 8 de 2007/04/12 Definitiva |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find -name "*..*" -type f | rename 's/\.\././g' # double dot | |
find -name "* *" -type f | rename 's/ /_/g' # spaces |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sed -e 's/./&\t/11' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# first 4 digits right justified with zero padding | |
nl -nrz -w4 file.txt | |
# end of line | |
awk '{ print $0, NR }' | |
# cat (no padding) | |
cat -n file.txt | |
# grep (no padding) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sed -nr '/pattern/,$p' |