Expression | Description |
---|---|
nodename | Selects all nodes with the name "nodename" |
/ | Selects from the root node |
// | Selects nodes in the document from the current node that match the selection no matter where they are |
. | Selects the current node |
.. | Selects the parent of the current node |
@ | Selects attributes |
[] | Condition on a selection |
This file contains 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(tidyverse) | |
head(test) %>% | |
{.->>intermed_result} %>% #save intermediate result | |
print() |
This file contains 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
#parse the date as a string and extract the day, | |
#compare it to the string value '1' and '15' and if it's equal to either, respond TRUE else respond FALSE | |
or((value.toDate('dd MMM yyyy').toString('d'))==toString(1),(value.toDate('dd MMM yyyy').toString('d'))==toString(15)) | |
#to be used as a Facet in OpenRefine |
This file contains 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(dplyr) | |
distinct(DataFrame,Column_To_Filter_On,.keep_all = TRUE) %>% | |
view('Dataframe distinct') |
This file contains 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
#Orignial Source: http://www.endmemo.com/program/R/grepl.php | |
#grepl returns TRUE if a string contains the pattern, otherwise FALSE; if the parameter is a string vector, | |
#returns a logical vector (match or not for each element of the vector). | |
grepl(pattern, x, ignore.case = FALSE, perl = FALSE, | |
fixed = FALSE, useBytes = FALSE) | |
#pattern: regular expression, or string for fixed=TRUE | |
#x: string, the character vector |
This file contains 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
if(value.endsWith(';'),substring(value,0,-1),value) |
Wildcard | Description |
---|---|
* | matches any element node |
@* | matches any attribute node |
node() | matches any node |
This file contains 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
import re #regular expressions in Python | |
def number_from_string(string): | |
return re.findall("\d+",string) | |
#The function will return a list of all digit sequences in the string |
This file contains 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
Get-ChildItem -Path C:\Demo -Filter *.txt | Rename-Item -NewName {[System.IO.Path]::ChangeExtension($_.Name, ".old")} |
This file contains 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(dplyr) | |
#we want to produce a frequency table of the length (nchar) of a column 'column' of our dataframe 'dataset' | |
mutate(dataset,nchar=nchar(column)) %>% count(nchar) |
OlderNewer