Questions tagged as 'r'

1
answer

Problems to plot graph with function chartSeries of the quantmod package from a data.frame in R

I'm having trouble plotting a candlestick chart from a data.frame file. Code sample # Pacotes necessários ---------------------------------------------- library(BatchGetSymbols) library(quantmod) # Inputs necessários ---------------...
asked by 13.12.2018 / 17:23
1
answer

Sort a vector of texts using regular expressions using R

Let's say I have the following text vector ( character ): d <- data.frame(id=1:3, txt=c('Um gato e um cachorro', 'Cachorros jogam bola usando alpargatas', 'gatinhos cospem...
asked by 03.10.2014 / 21:18
1
answer

create looped objects

I need to do several aggregate. For example: 2012ocup10 <- aggregate(PNAD2012[c("peso_pes")], by=PNAD2012["klems"], FUN=sum,na.rm=T) But I need to do the same procedure for PNAD2011,PNAD2010, ... I use...
asked by 18.09.2014 / 21:03
1
answer

R does not create chart correctly

I'm using R to generate charts of a table, with two fields (company name and sales quantity), when using barplot, it is not putting the right values in the fields. For example, if sales were 500,000 it will make the chart the highest value 50...
asked by 06.10.2015 / 22:25
1
answer

How to extract all nth element from a list?

Considering a list consisting of several vectors: lista<-list(c("1949", "1963", "45", "X2752009", "X2752013", "X2753007", "X2850009", "X2851005", "X2851008", "X2851014", "X2852002", "X2852003", "X2852011", "X2852016", "X2852020", "X2853005"...
asked by 23.05.2016 / 17:06
2
answers

Decomposition of Daily Time Series

I have a time series of daily flow data. I am trying to decompose the ST to remove the trends and seasonalities. But when I use the decompose function the seasonal chart appears a black blur. QHE.ts <- ts(QUHE.z, freq = 365.25)...
asked by 30.06.2015 / 16:03
2
answers

How to import data (.csv) into the R while retaining the original format

I'm trying to import Excel data (already in .csv format) into R; the values contained in the files to be imported are in the following formats, for example 8509,80 ... To do the import, I am using the command: variavel=read.table("dados.csv...
asked by 04.07.2015 / 15:07
1
answer

What is the logic of function (x) and function (x, y) in R?

When executing loops with apply functions, function(x) is always used. Example: lapply(df,function(x)gsub('[^A-Z]','',x)) In other functions, however, function(x,y) is used. Example: Reduce(function(x,y)merge(x,y,all=TRUE,b...
asked by 21.09.2018 / 20:14
1
answer

Creating a dataframe based on two other dataframes using dplyr in R

These are my dataframes: df<- as.data.frame(matrix(rexp(200),, 25)) colnames(df)<-c("A","B","C","D","E","F","G","H","I","J", "K","L","M","N","O","P","Q","R","S","T", "U","V","X","Z","W") df.new<-as.data.frame(matr...
asked by 23.09.2018 / 04:36
1
answer

How to plot a graph with ggplot

I have the following data.frame: sample OPN1SW OPN1MW OPN1LW RHO OPN3 OPN4 OPN5 1: GTEX-11WQK-1026-SM-5EQLX 2.365 0.0000 0 4.138 86.322 40.199 12.533 2: GTEX-XQ3S-1426-SM-4BOPR 22.317 0.0000 0 30.6...
asked by 31.12.2017 / 15:52