Questions tagged as 'r'

2
answers

Adding factors to a data frame?

I have the following df: Factor Valor F1 1.224 F1 1.533 F1 0,77429 F2 3.477 F2 2.6767 F3 0.557 F3 1 How do I get the total values?     
asked by 26.06.2017 / 20:52
1
answer

Weighted linear regression using the inverse of the variance as a weighting factor

I have the following data set that establishes a relationship between two variables "X" and "Y": df <- data.frame(X=c(25,25,25,25,25,25,50,50,50,50,50,50, 75,75,75,75,75,75,100,100,100,100,100,100, 125,125,125,125,125,125,150,150,150,150,15...
asked by 19.11.2016 / 01:02
1
answer

Label does not appear on chart

Hello, My configuration is as follows: > sessionInfo()       R version 3.3.1 (2016-06-21)       Platform: x86_64-w64-mingw32 / x64 (64-bit)       locale:   _LC_COLLATE = Portuguese_Brazil.1252_, _LC_CTYPE = Portuguese_Brazil.12...
asked by 29.11.2016 / 14:29
1
answer

Create a package that depends on other packages

Personal I'm creating a package with some functions one of them depends on another package, as "gives the signal" for the R understand and install this package? The package I depend on is raster . a = matrix(c(0,0,2,0,2,2,0,2), byrow = T...
asked by 11.06.2016 / 00:37
1
answer

Problem loading winbugs into R

I'm trying to run a code in the R that loads the winbugs package I already have installed require(R2WinBUGS); But I'm having this error Read 180 items Error in file(con, "rb") : cannot open the connection In addition: Wa...
asked by 02.06.2016 / 21:17
1
answer

How to plot multiple graphs on an A4 sheet with defined margins?

To illustrate the question I considered the hypothetical situation below using the ggplot2 and gridExtra libraries. library(ggplot2) library(gridExtra) df<-data.frame(x=1:10,y=1:10) a<-ggplot(data = df, aes(x = x, y=y^...
asked by 10.12.2015 / 05:55
1
answer

How to save the address of the equal elements between vector and array?

I'm in doubt, I'd like to get the element a[1] and compare with b[1,1] and count as success, then the a[2] element compared to b[2,1] and so on, always per column. Then I want to compare a[1] with b[1,2]...
asked by 30.09.2015 / 16:29
1
answer

Turn level to Variable

I would like to create a new column, transforming Tab1612SojaRend$Nível.Territorial the levels "Great Region" and "Federation Unit" into columns. The Federation Unit has to be in the same column of the cities according to the state. Anoth...
asked by 11.12.2018 / 03:19
1
answer

Reading of PNAD 2016 data

When reading Pnad 2016, I ran the code below in r studio # Ler o dicionário de variáveis com as posições #devtools::install_github("tidyverse/readr") library(readxl) library(dplyr) library(readr) dic = read_xls("dicionario_das_variaveis_PNAD...
asked by 20.11.2018 / 01:06
1
answer

How to return to the most predominant category associated with a group?

I have a database, in which the a variable is the group variable and b is a variable with some categories. My goal is, within each group of a , to return what else appears in b . Consider dput : dataset=struc...
asked by 17.10.2018 / 17:44