Questions tagged as 'r'

1
answer

Plot grid histograms with fixed Y axis - R

I would like to plot two (or more) histograms in R where the Y axis prevails a global value for all histograms. I do not want overlapping histograms, but rather side by side. The more histogram I am, it adds (to the right) of the plot and all wi...
asked by 05.06.2017 / 18:56
1
answer

Error: object of type 'closure' is not subsettable

I am trying to encapsulate a code in functions but in the process this error happens:    object of type 'closure' is not subsettable But I can not find why. Here is the code working: h = (b-a)/n B = array(0,c(n-1,n-1)) #gera Matriz (n-...
asked by 21.12.2016 / 19:33
1
answer

Concatenate two columns of an array by forming a string of characters

Suppose I have the following vectors: n <- c(1:5) c <- c("A","B","C","D","E") I build the following array with them: m <- matrix(c(n,c), ncol = 2) What is the best way to get a vector like this: "1 - A", "2 - B", "3 - C", "4...
asked by 17.01.2017 / 20:28
1
answer

In R, create a function to change some levels of a variable

I want to create a function that makes my life easier when handling some variables I want a function that receives as input a database, a column or variable u from that database, a vector c specifying the levels to be changed and the new name...
asked by 30.01.2015 / 05:01
1
answer

How to remove unused categories in the database

Suppose I have the following database: df <- data.frame(categorias=c("A","B","C","D","E"), valores=seq(1:5)) When I make a subset of that date frame the categories I've removed continue. subdf <- subset(df, valores...
asked by 02.04.2014 / 19:07
1
answer

How to plot a line chart with different colors depending on the value?

Suppose the following data: set.seed(1) y<-rnorm(101) x<-seq(from=0, to=100,by=1) I want to make a plot with a line that has a different color for negative values. To make a point graph, simply use the command below: plot(x,y,col...
asked by 19.03.2014 / 17:49
1
answer

Workflow in R: strategies for organizing a data analysis project

Based on this SOEN question , I ask: / p> What strategies do you recommend to organize a data analysis project in R ? The project usually involves the following steps (not necessarily in that order): Load and "clean" a "raw" databas...
asked by 08.03.2014 / 02:52
1
answer

Operation with lists of very large sizes

I have a code that calculates the area of the intersection between two polygons and for this I use lists to save the coordinates of the vertices of the polygons, however they are many polygons and it takes an average of 6h to run the whole code....
asked by 14.06.2016 / 05:54
1
answer

Timeout when using httr: POST ()

Expensive, I'm trying to do a log conference in the website CREA-RS , but every time it is giving the following error: Error in curl::curl_fetch_memory(url, handle = handle) : Timeout was reached Does anyone know what might be happen...
asked by 12.08.2016 / 15:29
1
answer

Web Scraping: How to change the value of a drop-down button of a site using R?

I want to create a script in R to read an HTML table. Doing this from a static page with the rvest package is easy, the problem is that I have to change the value of two buttons on the page. The site is this here . Note that above the...
asked by 21.06.2016 / 05:34