Questions tagged as 'data.frame'

1
answer

R filter sets

I'm taking the first steps in programming and with the R language and I have the following doubt I have a birthday dataframe with the following format Months | Person April Joao March Ana April Carlos June Joan March Pedro...
asked by 08.01.2015 / 16:23
3
answers

R: Remove columns from a dataframe [duplicate]

How can I remove columns from a dataframe without being as follows? > df x y z 1 1 6 A 2 1 5 B 3 2 4 C 4 2 3 D 5 3 2 E 6 3 1 F > df <- data.frame(df[,1:2]) > df x y 1 1 6 2 1 5 3 2 4 4 2 3 5 3 2 6 3 1     
asked by 22.12.2015 / 17:50
3
answers

How to compare columns from one dataframe with those from others and remove columns that are not common between them [R]

Suppose I have 3 dataframes. In them, I have varying columns (eg x1, x2 ..., xn). However, not all of these columns coexist in all dataframes. My goal is to compare these dataframes and leave, EACH OF THEM, with the columns in common. Is it p...
asked by 23.08.2018 / 21:56
1
answer

How to create a column with specific conditions?

I have a database like this: cod ano MUNICIPIO pmat 1 110001 1998 ALTA FLORESTA D OESTE NA 2 110001 1999 ALTA FLORESTA D OESTE NA 3 110001 2000 ALTA FLORESTA D OESTE NA 4 110001 2001 ALTA FLORESTA D OESTE NA 5 1...
asked by 01.09.2018 / 17:51
2
answers

How to exclude rows from a Data Frame in R based on the values of one of the columns?

I want to exclude rows that have a certain value in a column. Let's suppose I have a DF where the first column is an index with letters of the alphabet, but, I do not know the position, I want the lines with a vowel index to be removed as I d...
asked by 08.03.2018 / 22:30
1
answer

r - average of one variable in relation to the values of another variable in a data frame within each grouping

This question is after a post by me recently. This is the link if you want to follow # I have a multi-column dataframe. How do I calculate the average of one of the variables based on the values of another variable within a grouping of one of...
asked by 10.08.2018 / 21:03
1
answer

How to delete any row from a data frame in R? [duplicate]

I have a date frame as follows: How do I remove the first line?     
asked by 15.07.2016 / 00:24
1
answer

Find common values in two different dataframes

Editing the question: I have two DataFrames of different sizes, they are: df1 = pd.DataFrame({'bc': bc_1}, index=altura_1) df1.shape()=(73,1) >>> print df1 bc 1.175441 0.002884 1.115565 0.001905 1.055689...
asked by 27.08.2018 / 18:40
2
answers

r - average of one variable in relation to the values of another variable in a data frame and withdraw values NA

I have a multi-column dataframe. How do I calculate the average of one of the variables based on the values of another variable? I have the frequency of several species found in 4 campaigns and I want to calculate the average of each recorded sp...
asked by 23.07.2018 / 22:33
1
answer

How to stratify / divide a data.frame according to categories of a variable in R?

I'm running a linear regression model in R and would like to perform stratified analysis by categories of a variável X with 4 categories ( X1 , X2 , X3 and X4 ). I thought of stratifying data.frame by th...
asked by 08.03.2017 / 20:42