Questions tagged as 'r'

1
answer

add column that shows how many times a value has already been repeated from that line back

I'm having trouble creating a column that shows how many times a row has already been repeated, but not in the entire dataset, but in that row. Ex: NOME ANO MES COLUNA_QUE_QUERO_CRIAR A 2016 4 1 A 20...
asked by 24.11.2017 / 17:23
3
answers

Use of the sub function in the R - string with special characters

I'm running a database with the following values: data $ Col_Nova
asked by 27.10.2017 / 14:33
1
answer

Customize boxplot

I have the following data: structure(list(NotasMateriais...4. = c(1L, 2L, 8L, 5L, 5L, 4L, 4L, 2L, 9L, 2L, 5L, 3L, 1L, 3L, 0L, 3L, 3L, 2L, 2L, 3L, 0L, 2L, 14L, 0L, 0L, 3L, 6L, 3L, 4L, 3L), NotasMateriais...5. = c(3L, 3L, 4L, 3L, 9L, 3L, 15L,...
asked by 13.11.2017 / 14:40
1
answer

Initial values in the nls function in R

Hello, I have the following code in R temp<-c(10,12,14,15,17,20,22,23,25,26,28,29,30) taxa<-c(2,4.5,6.1,7.0,11,16,19,21,22,11,2,0.1,0.001) taxa<-taxa/9 plot(temp,taxa) df<- data.frame(temp,taxa) x<- seq(1,45,length=100) library(...
asked by 19.01.2018 / 12:28
1
answer

Degrees of freedom anova R

I'm trying to run a basic one-way ANOVA in R. library(drc) data=S.alba aov(DryMatter~Dose,data=S.alba) However, there are 7 treatments in these data. Therefore, DF (degree of freedom) should be 7-1 = 6, but R shows DF as 1. I do not underst...
asked by 16.02.2018 / 19:41
1
answer

R - How to calculate price variation for different periods and companies?

Hello, I'd like to know how to calculate the price change from one period to the next. Being that are several years for several companies. Example:    Company | Year | Price       1 | 2007 | 25       1 | 2008 | 30       1 | 2009 | 7      ...
asked by 04.04.2018 / 00:01
3
answers

Aggregate function in R

Good afternoon. I'm using the aggregate function to group some data. However, I'm only using one variable to add. I would like to use more than one variable. It is possible? I'm using the following example: TESTE = aggregate(VALOR ~ REF...
asked by 05.12.2017 / 18:03
2
answers

How to include rows in a data.frame?

Consider the following data.frame : df <- data.frame(x=c("a","b"), y=c(1,2)) How to include a new line with x="c" and y = 3 in data.frame ?     
asked by 14.09.2014 / 14:47
1
answer

How to create a loop that turns columns into variables and returns shapiro.test at the end?

I have several .csv files with a large number of columns. I would like to optimize the work by creating a function that reads the columns and returns the normality test result ( shapiro.test ) of each of them. data <- read.csv2("C:/User...
asked by 03.09.2018 / 07:40
2
answers

Automate the creation of numbers in a loop in R

The digits after ^ ( 1 , 2 and 3 ) are the values that I want to automate (incrementally: from 1 to ith value): var1<-rnorm(3,5000,1300)/1.15^1 var2<-rnorm(3,5000,1300)/1.15^2 var3<-rnorm(3,5000,1300)/1.15^...
asked by 20.08.2018 / 05:28