Questions tagged as 'r'

2
answers

Is there a hash structure in R?

Is there any hash structure in R, similar to the Python and javascript dictionaries? This makes programming a lot easier.     
asked by 29.04.2015 / 22:30
5
answers

How to consolidate (aggregate or group) the values in a database?

Suppose I have the following database vendas<-c(100,140,200,300,20,1000,200,3000) vendedor<-c("A","B","A","B","C","C","D","A") regiao<-c("Norte","Sul","Leste","Norte","Sul","Norte","Leste","Sul") df<-data.frame(vendedor,regiao,vend...
asked by 27.02.2014 / 02:36
3
answers

Intersection area of two polygons

How to calculate the area of the intersection between two polygons? For example: a = matrix(c(0 ,0 ,2 ,0 ,2 ,2 ,0 , 2, 0, 0), byrow = T, ncol = 2) b = matrix(c(.5, 0 ,1 , 1, 1.5, 0, .5, 0), ncol = 2, byrow = T) The first column represents t...
asked by 04.06.2016 / 01:11
4
answers

Add rownames as column using dplyr

I would like to do something that is fairly simple using the common syntax of R, but using the dplyr package. The task is basically to add the row.names of a data.frame object as a column to that same object. Using mtc...
asked by 01.10.2014 / 20:11
4
answers

Why is 0.1 + 0.05 not equal to 0.15? What solutions can be used in R?

No R : 0.1+0.05 == 0.15 [1] FALSE Why does this occur? How to get around the situation (functions and packages to handle floating points)? Edition: This other question already contains general point answers floating, thus...
asked by 21.02.2014 / 17:06
2
answers

How to exclude element from a list in R

I have this list: x = list(1, 3, 5, 8, 13) How do I delete the second element?     
asked by 17.06.2016 / 04:04
1
answer

Scatter plot with marginal histograms

I would like to know if there is a way to make a graph similar to this in R: Is it possible to make a scatterplot plot and to the side or bottom, how does it display the image, put the histogram representing the data?     
asked by 16.01.2015 / 19:53
2
answers

What are the main functions to create a minimal example reproducible in R?

What are key functions to create a minimum repeatable sample in R? More specifically, I would like answers to the following topics: What are the functions to ensure that the sample database can be replicated? What are the function...
asked by 20.12.2017 / 00:41
3
answers

Pre-process large text files in R

I am writing a script, which I will make public, to open the RAIS microdata (unidentified, available here ) in R using MonetDB. However, the bank does not accept a vignette (,) as a decimal separator. Each RAF UFano.txt file is quite large (up...
asked by 09.10.2014 / 22:52
2
answers

Negative variance in R? Floating-Point Error Propagation

Suppose the following formula to calculate the variance: variancia <- function(x) { n <- length(x) (1/(n^2-n))*(n*(sum(x^2))-(sum(x)^2)) } See that it is equivalent to the var function in most cases: teste <- 1:5 var(t...
asked by 21.02.2014 / 21:14