Posts by Marcus Nunes • 17,915 points
372 posts
-
2
votes1
answer237
viewsA: "Join" two graphs in R
The code below solves your problem. Even, it randomly selects one of the vertices of the g.v1 to connect to the graph g.merchant. library(igraph) g.v1 <- graph.full(6, directed= TRUE)…
-
2
votes1
answer271
viewsA: Quadratic Curve Estimating Minimum Square using R
It seems to me that your data has no quadratic regression structure. I would create another data set as follows: set.seed(321) n <- 20 # numero de observacoes x1 <- rep(1:n/2, each=2) #…
-
1
votes2
answers5436
viewsA: How to change the language of natbib in Latex?
Good question. I can change the language using Biblatex. Below follow my files . tex and . Minimum Bib to get the same result as me. First, I show the file . tex: \documentclass{article}…
latexanswered Marcus Nunes 17,915 -
1
votes2
answers172
viewsA: Handle values of a data.frame
I couldn’t solve this problem in R. However, it can be solved easily on the Linux or Mac terminal, using tools that are already installed by default: cat swera_ghi_inpe_hi_res.csv | awk 'BEGIN…
ranswered Marcus Nunes 17,915 -
13
votes4
answers5814
viewsA: How to read microdata from ENEM in R?
The functions of the type read.csv that the R has carry in RAM the contents of the files being read. Thus, there are three main ways to work with large data that does not fit in memory R: Increase…
-
4
votes1
answer154
viewsQ: Integer overflow in R
I’m working on a population dynamics simulation that involves generating whole numbers. Due to the hypotheses of my model, I am generating random numbers through the function rmultinom R. However, I…
rasked Marcus Nunes 17,915 -
5
votes2
answers858
viewsA: What are the differences between require() and library()?
The following information is provided by the function’s own help require of R: library(package) and require(package) Both load the namespace of the package with name package and attach it on the…
ranswered Marcus Nunes 17,915 -
1
votes1
answer249
viewsA: Colorize a region of the graph
I believe that the best way to solve this problem, given this response to my above comment, is to make a polygon with the values of the function instead of trying to make a circle. Follow the code…
ranswered Marcus Nunes 17,915 -
7
votes1
answer647
viewsQ: Change facet_wrap order in ggplot2
See the code below, which generates the graph that comes soon after: library(lme4) library(ggplot2) ggplot(sleepstudy, aes(x=Days, y=Reaction)) + geom_point() + geom_smooth(method = "lm", se=FALSE,…
-
11
votes1
answer6021
viewsA: How to concatenate two strings?
Through command paste: paste("Olá", "mundo!", sep=" ") [1] "Olá mundo!" paste("Olá", "mundo!", sep="-") [1] "Olá-mundo!" Use the command ?paste to access the function help and learn its other…
-
3
votes2
answers667
viewsA: How to save a series of xls spreadsheets in csv using R?
It is not necessary to convert an excel spreadsheet (assuming that this means .xls or .xlsx extension files) into . csv to work with it on R. Install the package xlsx and its dependencies to run the…
ranswered Marcus Nunes 17,915 -
5
votes2
answers1588
viewsA: How do I place the inverted (decreasing) Y-axis in the R?
Just reverse the order of the argument ylim inside the command plot. Normally, it makes the axis go from minimum to maximum of the response variable. In your case, do the ylim vary from maximum to…
-
9
votes5
answers1065
viewsQ: Remove duplicated names with regular expression
Suppose I have the following vector, with the names of presidents of the republic: presidentes <- c("da Fonseca, DeodoroDeodoro da Fonseca", "Peixoto, FlorianoFloriano Peixoto", "de Morais,…
-
5
votes1
answer225
viewsA: Problem when plotting with ggplot2 R
If I understand your problem correctly, just remove the sort of the argument y of function ggplot: library(ggplot2) library(reshape) cultivar <- c("IB0094", "IB0094", "IB0094", "IB0094",…
-
6
votes1
answer673
viewsQ: How to correctly identify clusters using kmeans?
Suppose I wish to classify the specimens of 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:…
-
3
votes3
answers105
viewsA: Changing charts of a regression
Just change the pch argument of your Plot. For example, plot(fit1.summary, parm=2, ylab="beta", cex=1, xlab = "tau", pch = c(rep(c(2, 8), 7), 2)) Just adjust the vector with the pch values so that…
-
4
votes2
answers173
viewsA: Compare lines between two tables of data?
This code below works well. I imagine it’s fast even if your data frames are a little bit large. q1 <- data.frame(COD = 1:5, CLAS=letters[1:5]) q2 <- data.frame(COD = c(25,1,31,3,2),…
ranswered Marcus Nunes 17,915 -
2
votes3
answers126
viewsA: Organize data in excel
Try to rotate the command read.table(file="nomedoarquivo.csv", header=T, sep=",") This command will work if your file has columns named. If the columns are not named, replace the header=T argument…
-
1
votes1
answer91
viewsA: Including Trust Interval in a Row of a Matrix
Follow my suggestion. My code got a little dirty, slow and ugly, but I’m in a bit of a hurry. library(quantreg) y <- rnorm(200) x <- matrix(rnorm(123), 200) fit <- rq(y~x, tau=seq(0.05,…
-
2
votes4
answers4316
viewsQ: How to import a csv file to Mysql?
I am starting my studies in Mysql. I decided to install Mariadb 10.1.14 in Centos. I want to create a database from a file . csv with about 166 million lines. I looked for tutorials on the internet,…
-
9
votes1
answer2601
viewsA: Edit bar graph in R: Order of X-axis values - Caption - Bar color - Insert straight - Insert comments
I already notice in advance that I tried to answer your question, but I ended up leaving two details unanswered: insert the lines of the classes and their annotations next to them (I don’t…
-
1
votes1
answer110
viewsA: Parameter estimation using the Optim function
It was not clear to me what it means to "improve convergence". I ran your code on my machine and the function converged. If "improving convergence" means obtaining similar results in fewer…
ranswered Marcus Nunes 17,915