Questions tagged as 'r'

1
answer

Error installing R packages on GitLab CI

When I try to install R packages using shell , the following error occurs: My code for the gitlab-ci.yml file is as follows: before_script: - export DJANGO_SETTINGS_MODULE= ---- - pip install -r requirements.txt test: script:...
asked by 19.12.2016 / 15:45
1
answer

Problem with missings in the weight variable in complex sampling

The presence of missings in the variable weight of a complex sampling is preventing R to calculate the mean. I initially tried na.rm = TRUE , but it did not work, here is the excerpt: svymean(basedados$variavel , svydesign( id = basedado...
asked by 05.01.2015 / 18:23
2
answers

Functions with number of arguments "dynamic"

I want to construct a function that can have the number of variable parameters, such as the c function, and how to access their addresses, for example: c(a = 1, b = 2, d = 9) #acessar a, b e d Is it related to ... ? What do the...
asked by 23.06.2016 / 19:01
2
answers

Identify cases with several conditions in several columns in the R

I have a 20-student dataframe and I need to identify the students who attended Stage 43 for two years or more. aluno <- c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20) etapa_2012 <- c(42, 43, 44, 43, 42, 43, 44,...
asked by 04.04.2018 / 19:00
2
answers

Different Records

I have two tables: MATRICULA_A <-c(123,234,345,456) dados_1 <- data.frame(MATRICULA_A) MATRICULA_A <-c(345,456,111,222,333,444) dados_2 <- data.frame(MATRICULA_A) I need to extract only information from the dados_1 table...
asked by 23.11.2018 / 17:02
3
answers

How to include in the regression a variable raised to n

Suppose I have the following data x<-rnorm(100,1,10000) y<-rnorm(100,1,10000)+2*x+x^2 If I use the lm function as follows: model1<-lm(y~x+x^2) The R does not understand that it is to put between the independent variables the t...
asked by 18.02.2014 / 12:53
2
answers

How to transform a number with a comma in R?

I have a csv file, saved via Excel (using the ";" as a column separator). When I import it into R, the numbers that are in the 0.00 format are factored and comma. Ex: "123,45" When you do the conversion, it stays as text. num <- gsub(...
asked by 20.04.2018 / 22:04
2
answers

How to convert string (in Portuguese) into date?

I have data.frame with a column (month) that represents the month and year of each remark that is in the form of a string. I would like to modify it to date so I can use the proc in excel with date. How can I do it? mes...
asked by 26.07.2017 / 16:31
2
answers

How to check if a given sequence of elements exists in R?

I have a vector like this: vectorx<-c(3,3,1,1,1,2,2,2,2,2,2,2,2,2) and I want to check if the sequence 3,3,1,1,1,2 exists. It turns out that this sequence can be in any position of the vector, I just want to know if this sequence specifi...
asked by 27.11.2017 / 22:25
2
answers

Converting numbers into categories in R

In my database, I have a Variable TP_CorRaca with values 0,1,2,3,4,5. Each number corresponds to a color. Example: 0 - White 1 - Black 2-brown .... I want to make this match to use the lm ()     
asked by 06.03.2017 / 09:55