Posts by Wagner Jorge • 1,377 points
38 posts
-
4
votes1
answer90
viewsQ: How to read txt file with multi-dimensional datasets?
am with a dataset file composed of multiple dimensions in a single txt. For example, 2 3 #dimensao do primeiro dataset 1 2 3 4 5 6 4 4 #dimensao do segundo dataset 1 2 3 4 5 6 7 8 9 10 11 12 13 14…
rasked Wagner Jorge 1,377 -
2
votes1
answer235
viewsA: Plot 3D figures for list data
Dear, based on the answer I got in: https://stackoverflow.com/questions/40614888/plot-3d-prisms-using-ggplot2-and-plotly/41433697#41433697 I adapted the method to plot a polygonal base prism with…
-
7
votes1
answer235
viewsQ: Plot 3D figures for list data
I have a list a with three matrices and one vector v with any three frequencies (positive reals), these matrices form triangles through a function I created pplot. I wish to add vector information v…
-
3
votes1
answer36
viewsQ: Convert labels to numeric labels
I have labels stored as letters and want to convert to numerics, for example: a <- c("A", "B", "A", "A", "C", "E", "D", "A", "B") Desired exit [1] 1 2 1 1 3 5 4 1 2…
rasked Wagner Jorge 1,377 -
1
votes1
answer36
viewsQ: Access objects of the formula class
How do I access a formula objects separately? For example: e <- new.env() a <- list() b <- list() a[[1]] <- matrix(rnorm(20), 2) b[[1]] <- matrix(rnorm(20), 2) e$a <- a e$b <- b…
rasked Wagner Jorge 1,377 -
1
votes1
answer38
viewsQ: Transform class within package
Guys I have a matrix and I want to turn it into another specific class of a package, rgeos, place the @import in the package, give library in it too, but when I check it gives error that mistake. a…
-
2
votes1
answer67
viewsQ: Export package
Guys I created a package in the R, already with the documentation, with the @export in each role, I ask for the Rstudio create the package and all right. But when I import the package it reads all…
rasked Wagner Jorge 1,377 -
4
votes2
answers78
viewsQ: Functions with a number of "dynamic" arguments
want to construct a function that can have the number of variable parameters, as the function c, and how to access their addresses, for example: c(a = 1, b = 2, d = 9) #acessar a, b e d Has…
rasked Wagner Jorge 1,377 -
5
votes1
answer115
viewsQ: Operation with very large size lists
I have a code that calculates the area of the intersection between two polygons and for that I use lists to store the coordinates of the vertices of the polygons, however there are many polygons and…
-
6
votes1
answer279
viewsQ: 3D histogram using ggplot2
I have data of a two-dimensional distribution, for example, uniform. I wish to make a histogram with this data. I tried the package plot3D, but it wasn’t very nice. teste = matrix(runif(100), ncol =…
-
1
votes1
answer48
viewsQ: Create a package that depends on other packages
Staff I am creating a package with some functions one of them depends on another package, as "gives the signal" for R understand and install this package? The package I depend on is raster. a =…
-
6
votes3
answers1460
viewsA: Area of intersection of two polygons
Finally I was able to calculate. Datum a1 = matrix(c(0 ,0 ,2 ,0 ,2 ,2 ,0 , 2, 0, 0), byrow = T, ncol = 2) b1 = matrix(c(.5, 0 ,1 , 1, 1.5, 0, .5, 0), ncol = 2, byrow = T) Another example a2 =…
ranswered Wagner Jorge 1,377 -
12
votes3
answers1460
viewsQ: Area of intersection of two polygons
How to calculate the area of 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,…
rasked Wagner Jorge 1,377 -
3
votes1
answer109
viewsQ: Create package on Windows
Given a set of functions, like creating a package on Windows OS? For example for the two functions below: soma = function(x, y){ res = x + y res } multiplica = function(x,y){ res = x*y res }…
rasked Wagner Jorge 1,377 -
1
votes1
answer73
viewsQ: Nesting error
I need to make a graph in the concatenated R, are 4177 iterations, I’m using ggplot2, but is giving the error below: Error: evaluation nested too deeply: infinite recursion / options(expressions=)?…
-
1
votes3
answers319
viewsA: Remove dataset elements by factors
Thinking here I arrived at the following function. It is not very fast, but it serves. #numero_minimo no exemplo é 2 remove_fatores = function(dataset1, numero_minimo){ fatores = dataset1[,1] for(i…
ranswered Wagner Jorge 1,377 -
3
votes3
answers319
viewsQ: Remove dataset elements by factors
Recital a dataset: set.seed(1) fatores = sample(1:12, 30, replace = T) x = matrix(rnorm(60), ncol = 2) dataset = cbind(fatores, x) dataset = data.frame(dataset) dataset$fatores =…
rasked Wagner Jorge 1,377 -
5
votes2
answers1742
viewsQ: Processing time of functions
How I check the processing time of the subfunctions of a function in order to optimize it? I read about it in R help and in:…
-
3
votes1
answer212
viewsQ: How to check if a polygon is convex
How do I check if a polygon is convex? The input can be given by: #Por exemplo um quadrilátero, a primeira coluna é x e a segunda coluna é y. quadrilatero = matrix(c(0,2,-7,1,4,3, 4,5), ncol = 2)…
-
4
votes1
answer460
viewsQ: How to check if a polygon is regular or convex
Is there a function in R that checks whether a polygon is regular or not and some that checks whether it is convex or not? If either answer is no, any idea? As I thought: #Por exemplo um…
-
3
votes1
answer203
viewsQ: Graphical package faster than ggplot2
you know some package in R that concatenates and makes 2D and 3D graphics faster than ggplot2?
rasked Wagner Jorge 1,377 -
1
votes1
answer469
viewsQ: Overlay graphics with ggplot2?
I am learning to use ggplot2 and would like to make a chart and then overlay a point on it. For example: set.seed(1) a = data.frame(X1 = rnorm(3), X2 = rnorm(3)) g <- ggplot(a, aes(x = X1, y =…
-
5
votes1
answer137
viewsQ: Remove zero column from an array
I have a three-dimensional array and within 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,…
rasked Wagner Jorge 1,377 -
1
votes0
answers68
viewsQ: Calling C for R?
How do I program in C inside the R or call a code of C in R? I’ve read a few tutorials, but I don’t quite understand.
-
3
votes1
answer767
viewsQ: What is the symbol for direct product?
what is the symbol for direct product, as shown in the example? Ex.: (1,2,3,4)*(1,2,3,4) = (1, 4, 9, 16)
latexasked Wagner Jorge 1,377 -
2
votes0
answers61
viewsQ: How does the apply family work?
would like to know how the functions of the apply family work and if possible with examples. In what contexts best apply? Thanks since then!
-
1
votes1
answer67
viewsQ: How to store the address of the equal elements between vector and matrix?
I’m having a question, I’d like to take the element a[1] and compare with b[1,1] and count as a hit, then the element a[2] compared to b[2,1] and so on, always by column. Then I want to compare the…
rasked Wagner Jorge 1,377 -
3
votes1
answer857
viewsQ: How to get the first non-zero element?
I have the following problem, I have a matrix and I want to go through it and get the first line that has all the elements other than zero. For example: a = matrix(c(rep(0,4), 1:16), ncol = 4, byrow…
rasked Wagner Jorge 1,377 -
1
votes2
answers82
viewsA: Comparison of elements of a vector
I get it, all(a[1] == a) and all(b[1] == b)
ranswered Wagner Jorge 1,377 -
3
votes2
answers82
viewsQ: Comparison of elements of a vector
Staff need a function to check that all vector coordinates are equal. a = rep(1, 5) Let the previous output be TRUE. b = c(rep(1, 4),2) Let the previous output be FALSE.…
rasked Wagner Jorge 1,377 -
8
votes5
answers8758
viewsQ: How to remove line that has Missing?
I have a database that has some missings (NA’s), but only one variable (one column), and I need to remove the entire row that has Missing.
rasked Wagner Jorge 1,377 -
2
votes1
answer59
viewsQ: Majority vote step by step
I would like to know how I can calculate the majority vote step by step, for example by comparing column 1 with 2, per line, then 1,2 and 3, per line, then 1, 2,3 and 4, per line and so on.…
rasked Wagner Jorge 1,377 -
3
votes3
answers7652
viewsQ: Graphic overlay on R
how can I overlay two or more graphs without the limits of the axes also appear superimposed on the figure? a = rnorm(1000) b = runif(1000) plot(a, type = "l") par(new = T) plot(b, type = "l", col =…
rasked Wagner Jorge 1,377 -
3
votes2
answers63
viewsQ: Majority vote in matrix in R
I want to compare elements of a matrix, for example, in row 1 (fixed) I want to know which object happens with the most frequency and return the same, precise in an automated way, because the number…
-
2
votes1
answer85
viewsQ: Operation with large matrix
Staff would like to know how I can make the Euclidean distance squared between the octadimensional vectors of b and those who are not in a in a super matrix like this of the example. I thought so…
-
2
votes0
answers113
viewsQ: How to make an MLP in the R whose output is a posteriori and the test set classified?
I used the "neuralnet" function of the package of the same name, but I could not run. Yes, I want to sort, so I have labels.
-
5
votes1
answer122
viewsQ: Comparison of two matrices with different sizes
I have two matrices with these dimensions and would like to remove the common lines between the two matrices and form another matrix without these elements. How R could do that? a = matrix(1:30,…
-
2
votes2
answers138
viewsQ: Use "NA" for logical operation on R
I’m with the situation: a = c(1,2,3, NA, 5, 6, NA) b = 99 for(i in 1: 7){ if(a[i] == "NA"){ a[i] = b } } The problem is that R does not make the logical comparison using "NA" or NA.…
rasked Wagner Jorge 1,377