Questions tagged as 'r'

1
answer

In R, when a vector becomes "too long"?

When trying to create an infinite vector ( 1:Inf ) I received the following message:    Error in 1: Inf: result would be too long to vector However, when the vector does not know in memory the message is usually different. The code...
asked by 02.03.2017 / 18:18
2
answers

What are the differences between require () and library ()?

In R, what are the differences between require() and library() , if any? When should I include require() and when should I include library() ?     
asked by 18.09.2016 / 05:50
1
answer

Sort of dates ggplot2

Hello, this is my first question in this% s% s and I have not mastered it yet.  I'm learning this wonderful language and now I'm having serious problems plotting a graph using the R package, the data is dates and they do not follow the natural...
asked by 20.02.2018 / 13:02
1
answer

Change padding orientation in graphic

I would like to know if there is a possibility to change the color fill orientation of the following graphic WhatIwantisforthecolorstobefilledfromtheoutsidetotheinside.Anyonehaveanyideas?dat<-structure(list(Category=structure(1:15,.Label=c...
asked by 16.02.2018 / 19:21
1
answer

Character conversion to Date - 4 digits

I'm having a hard time using as.Date to convert a column with dates (year with only two characters) into date. As.Date autocompletes the year in the wrong way, producing results like 2066 (instead of 1966) > head(data_de_nascimento)...
asked by 28.07.2016 / 21:38
1
answer

How to correctly identify clusters using kmeans?

Suppose I want to sort the specimens from the iris dataset using the k-means method. Also, I want to assess whether the rating was good or not. The easiest way to do this is as follows: iris.kmeans <- kmeans(iris[, 1:4], 3) table(iris$Speci...
asked by 16.08.2016 / 19:22
1
answer

Improvement of code

Good afternoon. I have the following data structure: structure(list(CIDADE = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("A", "B"), class = "factor"), MES = c(1L, 2L...
asked by 24.07.2017 / 19:24
1
answer

Arguments barplot

I made a graph with the barplot function, and I need to change the angle of the text on the X axis because the words are long. I know that to put them vertically use las = 2, but I want them to be inclined (an angle of 45 °). How do I do? Thi...
asked by 13.09.2017 / 17:13
1
answer

How to sort elements (select elements randomly) from a vector?

How can I sort elements (select elements randomly) from a vector in R ? For example, I want to sort elements of this vector: numeros = c(1,2,45,63,29,100,999,23.45,76.1)     
asked by 17.12.2015 / 14:12
1
answer

Remove zero column from an array

I have a three-dimensional array and inside that array there is another array of zeros and I want to remove it from the larger array. For example, set.seed(1) a = rnorm(60) b = array(a, dim = c(10, 2, 5)) b[, , 4] = matrix(rep(0, 20), ncol = 2...
asked by 04.01.2016 / 18:14