Title: | Translate Quantities from Strings Spelled in Spanish to Integer |
---|---|
Description: | Character vector to numerical translation in Euros from Spanish spelled monetary quantities. Text must be previously cleaned & removed extraneous words, symbols or cents. Quantities MUST be written in a correct Spanish cause this isn't a grammar tool. Upper limit is up to the millions range. Reverse translation using to_words. Geocoding via Cadastral site. |
Authors: | Jose Manuel Vera Oteo [aut, cre] |
Maintainer: | Jose Manuel Vera Oteo <[email protected]> |
License: | GPL-3 |
Version: | 0.5.0 |
Built: | 2024-08-31 04:19:57 UTC |
Source: | https://github.com/rOpenSpain/spanish |
Randomly selected data from catastro to test geocode_cadastral function
data(cadastral_references)
data(cadastral_references)
A data frame.
Catastro. Ministerio de Hacienda y función pública. (Catastro)
## Not run: ## source is cadastral reference number ## geocode_cadastral("0636105UF3403N", parse_files = FALSE) ## Use lapply to geocode cadastral references from dataframe columns. cadastral_references$new <- lapply(cadastral_references$cadref1, geocode_cadastral) ## separate previously generated "new" data into columns usign tidyr library(tidyr) separate(cadastral_references, new, into = c('longitude','latitude'), sep = "," ) ## source is folder. A loop is needed to process each kml file ## files <- list.files("folder", full.names = T) for (f in files) { coords <- geocode_cadastral(f, parse_files = TRUE) d <- as.data.frame(rbind(d , as.data.frame(coords, stringsAsFactors = F ))) } # separate lat/lon into columns if you prefer using tidyr d <- tidyr::separate(coords, into = c("longitude","latitude"), sep = "," ) ## End(Not run)
## Not run: ## source is cadastral reference number ## geocode_cadastral("0636105UF3403N", parse_files = FALSE) ## Use lapply to geocode cadastral references from dataframe columns. cadastral_references$new <- lapply(cadastral_references$cadref1, geocode_cadastral) ## separate previously generated "new" data into columns usign tidyr library(tidyr) separate(cadastral_references, new, into = c('longitude','latitude'), sep = "," ) ## source is folder. A loop is needed to process each kml file ## files <- list.files("folder", full.names = T) for (f in files) { coords <- geocode_cadastral(f, parse_files = TRUE) d <- as.data.frame(rbind(d , as.data.frame(coords, stringsAsFactors = F ))) } # separate lat/lon into columns if you prefer using tidyr d <- tidyr::separate(coords, into = c("longitude","latitude"), sep = "," ) ## End(Not run)
Randomly generated spanish spelled monetary integers to test to_number function
data(cantidades)
data(cantidades)
A data frame.
to_number("mil trescientos noventa y dos") ## testing provided dataframe: cantidades cantidades$var3 <- lapply(cantidades$var2, to_number)
to_number("mil trescientos noventa y dos") ## testing provided dataframe: cantidades cantidades$var3 <- lapply(cantidades$var2, to_number)
Get longitude/latitude from valid cadastral ref. or kml files from catastro.
x |
A valid spanish cadastral reference. |
parse_files |
bool. Default to FALSE. Set TRUE if source are KML files. |
A string for longitude/latitude if found. NA if not found.
You may be banned if many requests in short time are made.
## source is cadastral reference number ## ## Not run: ## geocode_cadastral("0636105UF3403N", parse_files = FALSE) ##"36.5209422288168,-4.89298751473745" ## Use lapply to geocode cadastral references from dataframe columns. cadastral_references$new <- lapply(cadastral_references$cadref1, geocode_cadastral) ## separate previously generated "new" data into columns usign tidyr # library(tidyr) # separate(cadastral_references, new, into = c('longitude','latitude'), sep = "," ) ## source is folder. A loop is needed to process each kml file ## # files <- list.files("folder", full.names = T) # for (f in files) { # coords <- geocode_cadastral(f, parse_files = TRUE) # d <- as.data.frame(rbind(d , as.data.frame(coords, stringsAsFactors = F ))) # } # separate lat/lon into columns if you prefer using tidyr # d <- tidyr::separate(coords, into = c("longitude","latitude"), sep = "," ) ## End(Not run)
## source is cadastral reference number ## ## Not run: ## geocode_cadastral("0636105UF3403N", parse_files = FALSE) ##"36.5209422288168,-4.89298751473745" ## Use lapply to geocode cadastral references from dataframe columns. cadastral_references$new <- lapply(cadastral_references$cadref1, geocode_cadastral) ## separate previously generated "new" data into columns usign tidyr # library(tidyr) # separate(cadastral_references, new, into = c('longitude','latitude'), sep = "," ) ## source is folder. A loop is needed to process each kml file ## # files <- list.files("folder", full.names = T) # for (f in files) { # coords <- geocode_cadastral(f, parse_files = TRUE) # d <- as.data.frame(rbind(d , as.data.frame(coords, stringsAsFactors = F ))) # } # separate lat/lon into columns if you prefer using tidyr # d <- tidyr::separate(coords, into = c("longitude","latitude"), sep = "," ) ## End(Not run)
The spanish package provides some functions for spanish data: to_number() geocode_cadastral() to_words()
Translate spanish spelled quantities into their integer counterparts. Allows you to translate to integer numerical words spelled in spanish. Text must be previously cleaned & removed extraneous words or symbols. Quantities MUST be written in a correct Spanish (this is not a grammar tool) The upper limit is up to the millions range. Cents must be removed. (in my TODO list to parse cents part)
Translate to spanish spelled quantities from integers
geocode by longitude and latitude from cadastral references. Get longitude/latitude from valid cadastral ref. or kml files from catastro.
Allows you to translate to integer numerical words spelled in spanish. Text must be previously cleaned & removed extraneous words or symbols Quantities MUST be written in a correct Spanish (this is not a grammar tool) The upper limit is up to the millions range. Cents must be removed.
x |
A spanish spelled number. |
to_number("mil trescientos noventa y dos") # Example table is provided: cantidades cantidades$var3 <- lapply(cantidades$var2, to_number)
to_number("mil trescientos noventa y dos") # Example table is provided: cantidades cantidades$var3 <- lapply(cantidades$var2, to_number)
Takes any integer from zero to millions range and returns spanish characters
x |
A valid integer amount. |
A string for the same integer number in spanish.