Questions tagged as 'r'

1
answer

Avoiding the use of For

Once again here trying to do things without the use of for , I have a problem that has a solution with for but I would like to give it a focus without for . The problem is that I have some data with days and I want to creat...
asked by 03.06.2018 / 15:53
2
answers

Reduce the substitution with "str_replace_all" in R

how can I get the str_replace_all when I make the first substitution (match) and stop looking for more matches in the dictionary code that I have. library(stringr) x <- c("VALLE PINO CORSO","LA PAZ","PAZ") dictionary bad words (malpa...
asked by 15.02.2018 / 23:23
2
answers

Operate media and graph in R from a csv with data listed

I have a data file that, minimized (the original file contains more rounds and levels of "Content"), responds more or less to the following structure ( data ): Ronda Contenido Salida 1 0 [1,1,1,1] 1 0 [1,1,1,1] 1...
asked by 12.09.2018 / 20:06
2
answers

Read table (HTML) with rvest

I am trying to read the table of the history of the monthly minimum wage of Colombia, the Bank of the Republic publishes the history in the following link Minimum legal salary in Colombia but I can not get the correct reading of the table. Any...
asked by 23.07.2018 / 02:13
2
answers

use aggregate based on two columns of the data frame

I have a data matrix (dfA) with several columns: province (dfA is a subset for one of the provinces), municipality, crop, number of farms, area, production ... And I want to calculate the number of total farms , total area, total production ......
asked by 02.03.2017 / 18:40
2
answers

Flatten matrix in R

I have a dataframe with the following format: And I would like to get a dataframe with the following format: That is, the unique names would be the identifiers by rows and the unique events the identifiers by columns, so that y...
asked by 18.09.2018 / 13:41
2
answers

extract equal data from columns

Hi I am trying to find the names that are the same between the two columns as the following example. [,1] [,2] [1,] "jara" "moreno" [2,] "moreno" "lopez" [3,] "diaz" "Swanson" [4,] "powell" "jara" [5,] "Mckin...
asked by 08.05.2018 / 22:08
2
answers

Alternative to nested lapply

I open the question to have a reference of the available options, in Spanish. Suppose we have a data set like the following: set.seed(2018) mi_df <- data.frame(stringsAsFactors = F, var1 = rnorm(50),...
asked by 02.02.2018 / 18:34
1
answer

Delete only the final "O" but respect the letter in "HELLO"

I am interested in eliminating the O of each word, except that that word is HELLO . I'm trying this but it does not work for me: a <- c("HELLO DO","DO HELLO XO","HO") gsub("[^HELLO]O\>","",a) [1] "HELLO " " HELLO " "HO...
asked by 05.12.2017 / 05:44
1
answer

R: put labels on a map

I would like to sketch in the map of Spain in R and add some points in certain coordinates that I have in a CSV file; how are you: Aranjuez<-39.595520, -3.391830 San Martin de la vega<- 40.225155-3.530613 Ruta...
asked by 08.02.2018 / 18:01