Posts by orrillo • 975 points
19 posts
-
2
votes1
answer436
viewsQ: In R, how to transform Tibble into dataframe
I have a Tibble structure resulting from the following script, using the purrr package: data %>% group_by(REGIAO , V1023) %>% nest() %>% mutate( teste = map(data, ff)) Where ff is a…
-
6
votes1
answer230
viewsQ: In R, a function that reads only a few columns of a dataframe in Rda format
I have 27 txt files. Each file represents a state of brazil. In fact, each file is dataframe on labor market. The 27 files can add up to more than 20 gigs. The first thing I did to reduce this was…
-
2
votes1
answer134
viewsQ: In R, use dplyr functions to find the minimum distance
I have a matrix with two numerical variables: lat and long. Like this: > head(pontos_sub) id lat long 1 0 -22,91223 -43,18810 2 1 -22,91219 -43,18804 3 2 -22,91225 -43,18816 4 3 -22,89973…
-
2
votes1
answer67
viewsQ: In R, use fread in a Shh connection with pipe
I have a virtual machine with many TXT files. I usually use an ssh and pipe connection to read the files. When I use the read.csv function there is no problem at the time of reading the files.…
-
8
votes1
answer2268
viewsQ: In R, using the plotly package, can I plot the map of Brazil and its states?
I really like the package plotly to make interactive graphics. But at the time of making maps, I have not found so far a way to make the map of Brazil and its states... For example, I removed this…
-
7
votes1
answer391
viewsQ: In R, correct typing errors followed by a database processing
This problem is quite complex and needs two stages. The first stage consists of correcting typing errors in a database (perhaps a probabilistic solution). The second stage is to tidy up this…
-
3
votes2
answers1739
viewsQ: In R, sort a data frame by column and by groups
I want to sort a data frame according to a v2 column and respecting the groups column. For example, suppose I have df as follows df v1 v2 grupo 1 5 1 4 1 1 1 2 1 5 7 2 4 2 2 1 9 2 I want the result…
-
3
votes1
answer399
viewsQ: In R, how to define a function with undefined arguments of the same nature
Dear friends, I am defining one function from another. However, I want to define my new function with several arguments of the same nature. For example My basic function is well-defined…
-
3
votes3
answers1398
viewsQ: in R, create a vector rounding function so that the coordinates vanish 100
I have a vector of percentages, for example, v<- c(32.5 , 43.2 , 24.1) > round(v) [1] 32 43 24 > sum(round(v)) [1] 99 I want a function that manipulates my surroundings so that it adds up…
-
9
votes2
answers3449
viewsQ: In R, count words and enter a line break
Dear friends, good afternoon Suppose I have a vector the following way caption<- c("I really liked the performance", "I didn’t like the performance", "I neither liked nor disliked") I want to…
-
5
votes1
answer995
viewsQ: In R, create a function to change some levels of a variable
I want to create a function that facilitates my life when treating some variables I want a function that receives as input a database, a column or variable u of that database, a vector c specifying…
-
2
votes1
answer197
viewsQ: in R, Dec="," does not work in read.csv2
Good afternoon to you... I’m trying to import csv where decimals are separated by dots... or something like 2.5 I want when it’s time to import it to show up with a comma, something like that, 2.5…
-
3
votes2
answers170
viewsQ: In R, using dplyr, create a new matrix
Suppose I have the following database >data zona candidato votos 1 A 100 1 B 20 2 A 30 2 B 15 I want, using dplry, the following matrix >nova zona votos_zona votosA votosB 1 120 100 20 2 45 30…
-
2
votes2
answers4318
viewsQ: How to save or reserve a list of objects? (R)
In R, I’m wanting to "keep a list of matrices". In fact, I’m wanting to reserve a list of 10 objects, where each object will turn into an array, after using a for() Something like that: Data <-…
-
6
votes2
answers381
viewsQ: Create new matrix from a fairly large first efficiently
Guys, in R, I have a very large database and want to create new columns. I will try to explain my problem with a very small matrix. Next, "1" means private school and "2", publishes. I have for…
-
1
votes1
answer101
viewsQ: Convert Character with precision
whereas the content of a certain variable is "001" class Character. I need to transform that character to numeric. If I do as.numeric(), he returns me 1. I want you to return me exactly 001, is it…
-
2
votes1
answer361
viewsQ: Understanding the Survey
Come on... I’m studying the Survey package I started studying this page http://www.ats.ucla.edu/stat/r/faq/svy_r_scpsu.htm but my questions are more basic I have already uploaded the following…
-
6
votes1
answer1449
views -
11
votes1
answer1619
viewsQ: The order function in R
I don’t understand what happens. Watch > x<-c(-2,4,-6,5,9,7) > x [1] -2 4 -6 5 9 7 > order(x) [1] 3 1 2 4 6 5 I don’t understand why vector x is not ordered. Note, when I give order(x)…