Questions tagged as 'data.frame'

3
answers

How to select all data.frame variables at once for a regression?

Suppose the following data.frame : set.seed(1) dados <- data.frame(y=rnorm(100), x1=rnorm(100), x2=rnorm(100), x3=rnorm(100), x4=rnorm(100)) If I want to run a regression of y against x1 ... xn , I can do it as fol...
asked by 19.02.2014 / 14:37
1
answer

What function in R to reorder a data.frame that contains missing data (NA)?

I have the following data.frame : Linha Data Total Med.2 DP.2 Med.3 DP.3 Med.4 DP.4 1 2009 1.4749 NA NA NA NA NA NA 2 2010 2.9945 2.2347 1.0746 NA NA N...
asked by 01.11.2015 / 04:44
1
answer

How to read a table missing elements or misconfigured?

Suppose a table in the form of text like the following: texto <- "a b c e f g h i" When I use the read.table command, it gives the following error: tabela <- read.table(text=texto) Error in scan(file, what, nmax, sep, dec, quote, sk...
asked by 26.02.2014 / 17:31
1
answer

Build Data Frame with "get"

This is my data.frame: data<-read.csv2("NewEXEMPL.csv",header=TRUE,sep=";") head(data,5) DATE P.A i.A S.A w.A b.A P.B i.B S.B w.B b.B P.C i.C S.C w.C b.C 1 jun/79 16.86 59.67768...
asked by 09.05.2016 / 00:17
1
answer

How to remove unused categories in the database

Suppose I have the following database: df <- data.frame(categorias=c("A","B","C","D","E"), valores=seq(1:5)) When I make a subset of that date frame the categories I've removed continue. subdf <- subset(df, valores...
asked by 02.04.2014 / 19:07
1
answer

EWMA volatility in a data.frame

I have a data.frame base_retorno_diario , 3560 observations in 110 actions (daily returns), I want to create another data.frame from that with Volatility ewma with decay_factor = 0.97 Data.frame example Data IBOV...
asked by 21.05.2014 / 20:47
2
answers

Convert column from date frame of characters to numeric

When trying to convert the text values of the columns of a data.frame , created using Stringasfactor = FALSE , numeric, I got an abnormal result by coercion: > str(ccredito$Restaurantes) chr [1:20] "49,74" "15,98" "59,4" "14" "...
asked by 12.05.2016 / 21:30
1
answer

Select first lines depending on group efficiently

Suppose I have the following database set.seed(100) base <- expand.grid(grupo = c("a", "b", "c", "d"), score = runif(100)) And I want to select the lines with the lowest score depending on the group according to the table below:...
asked by 28.01.2015 / 13:50
2
answers

Complete observations in a data frame

Suppose I have the following dataset: dados <- structure(list(Ano = c(2001L, 2001L, 2001L, 2002L, 2002L, 2002L, 2003L, 2003L, 2003L, 2004L, 2004L, 2004L, 2005L, 2005L, 2005L, 2005L), Categoria = structure(c(1L, 2L, 4L, 1L, 3L, 4L, 1L, 2L,...
asked by 05.09.2017 / 22:28
2
answers

Deleting Double Rows from a Data.Frame

I have data.Frame with the following behavior: values ind 1 10.82000 2011-01-03 2 11.75000 2011-01-03 3 10.82000 2011-01-03 4 11.75000 2011-01-03 5 10.82000 2011-01-03 6 11.75000 2011-01-03 7 10.84048 2011-01-04 8 11...
asked by 12.10.2015 / 16:42