Questions tagged as 'r'

1
answer

How to handle multiple quotes in R?

My problem is to use the quotation marks in a query within an R function. I have to call a list of select * from probes."probes_90_2018-05" For this I do: coelho<-dbConnect("PostgreSQL", fnord) dbGetQuery(coelho,"select * from probe...
asked by 11.07.2018 / 23:17
1
answer

Number of decrements in a dataframe

I have a data frame where in each column is the value of events in the period, I need to calculate the increment and decrement of these periods for a larger base and I could not do: p1<- rep(2:11) p2<- rep(3:12) p3<- rep(1:10) p4<-...
asked by 20.12.2017 / 17:42
1
answer

Building new variables using dplyr

I have the following database Clientes.Dep..Gratuito.PCG Clientes.Dep..Gratuito Clientes.Dep..Não.Gratuito 0 0 0 0 0...
asked by 28.07.2017 / 15:59
2
answers

* apply with three-argument functions in R

I've created a three-argument function and I want to apply it to a 200 X 3 matrix where on each line are the three arguments I need to use in the function. As a result I would get a vector of size 200. How can I do this?     
asked by 27.06.2014 / 07:44
2
answers

Function using as successive values of a column (R)

I have a data.frame with 13 columns and 78 rows. I need to do for each column ((x1/x2)^12)-1 , being x1 the value contained in the first row of the first column, x2 the value contained in the second row of the first co...
asked by 04.06.2014 / 22:12
1
answer

3D Histogram using ggplot2

I have data from a two-dimensional distribution, for example, uniform. I want to make a histogram with this data. I tried the package plot3D , but it was not very cool. teste = matrix(runif(100), ncol = 10) plot3D::hist3D(z = teste, bt...
asked by 13.06.2016 / 22:11
4
answers

How to transport data from R to excel?

I calculated a series of data in R and would like to know which command I should use to move them to an excel spreadsheet.     
asked by 26.03.2014 / 19:55
2
answers

Reorder the categories in a data frame

When we import data into R it sorts the categories alphabetically. How do I change this order? Suppose it is the following data: df <- data.frame(categorias=c("Muito baixa","Baixa","Média","Alta","Muito alta"), valores=s...
asked by 02.04.2014 / 19:17
1
answer

How do I export a polygon created by drawPoly as a shapefile?

I created a shape using the drawPoly() (package raster ) function that manually draws the polygon. At the end of the selection it generates a SpatialPolygon , but I can not export because it is not a SpatialPolygonDa...
asked by 17.11.2015 / 13:58
1
answer

How to turn hours in seconds in R?

I have the following times:    2:00:00 3:00:00 6:00:00 4:00:00 4:00:00 3:00:48 1:00:00 3:00:00 2:00:00 4: 00:00 1:30:00    2:00:00 1:00:00 3:00:00 4:00:00 4:30:00 5:00:00 1:00:00 1:30:00 2:00:00 3:00:00 3:00:48    4:00:00 4:30:00 How to...
asked by 06.10.2014 / 02:21