Questions tagged as 'r'

1
answer

How to separate a time series base into periods

I have a time series basis. In the base it has information of consumption of ration of pigs (it follows below with information of only one day and one animal). There is a column with the identification of the animal, day and time of day that the...
asked by 11.09.2017 / 21:49
2
answers

How to group data by an id in R

I have the following database: id x 1 2 1 3 2 3 3 3 3 3 3 3 I wanted to create a new database without repeating the value of the field id , to solve this I can average the values of field x tha...
asked by 12.04.2015 / 19:19
2
answers

How to invert the order of the labels in a bar graph stacked with ggplot2?

I'm trying to create a chart with the following code: ggplot(data=percent.prod, aes(x=Ano, weights=Percent)) + geom_bar(aes(fill=Tec), color="Black") + geom_text(aes(x=Ano, y=Percent, group=Tec, label=Percent),...
asked by 19.11.2017 / 15:28
1
answer

Filling rows with the correct data in R, joining successive rows

I have a database with the second structure: a=as.data.frame(tribble( ~a, ~texto, ~x2007, ~x2008, "a","aa",0,0, 0,"--",12,13, "b","bb",1,2, "c","cc", 0, 0, 0,"dd", 0,0, 0,"ee",7,8)) Lines beginning with zero are...
asked by 01.09.2018 / 22:28
1
answer

Error in Conditional Operations in Language R

I am programming a simple recursive algorithm to calculate the Fibonacci sequence in R, just as I do in C. It follows the same thing below: fibonacci <- function (n) { if (n == 1L) return (0L) else if (n == 2L || n == 3L) return...
asked by 22.09.2018 / 15:34
1
answer

Error in R with list2env function

I try to convert my list (which contains 12 dataframes and approximately 20,000 lines each) into separate dataframes: list2env(mylist,envir=.GlobalEnv) but the following error message appears: names(x) must be a character vector of the sa...
asked by 28.08.2018 / 20:22
1
answer

Stopword does not work

Hello, I made the program that is used to do basic text preprocessing for use in text mining tools. It should be something trivial, but I can not see where it might be wrong. ##################################################### ## ## Exemp...
asked by 01.10.2018 / 19:03
1
answer

Creating Dummy Variables

I'm trying to turn every variable in my database into dummy variables: >dados X1 X2 X3 1 1 3 1 2 3 2 1 3 3 2 1 4 2 3 2 5 2 3 3 I'm trying to create binary vectors for this. But, I can not do it right. Since I have 3 cate...
asked by 05.11.2018 / 14:28
1
answer

What is rank-deficient and how to get around it?

I made a linear regression lm() , where I declared some variables as factor , and got some betas as NA as: citySão José NA When I made the prediction, the prediction occurred and I received the following warning: Warnin...
asked by 23.10.2018 / 20:30
1
answer

Error importing numbers with decimals in R

I am trying to import a column of decimals into csv (part of a dataset) through the function read_delim . However, the columns with decimal numbers (separated by commas in the original dataset) are coming as integers. Ex: 175,60 app...
asked by 15.10.2018 / 13:47