Skip to main content

All Questions

Tagged with
1 vote
2 answers
167 views

How can I transpose a gtsummary tbl_summary object?

In my hypothetical scenario, 100 people are asked: What is your favorite color of car, shirt, and website (red, blue, or yellow)? This yields my mock data frame: colors <- c("red", "...
TJ87's user avatar
  • 532
1 vote
1 answer
3k views

Pandas pivot_table dropped a column, although no aggregation is done, only reshape

Im trying to use Pandas pivot_table function to reshape my data-frame. But it fails on specific rows and I get the message: FutureWarning: pivot_table dropped a column because it failed to aggregate. ...
user2424097's user avatar
0 votes
1 answer
59 views

create and aggregate variable for time/ .5hz in r

I'm trying to create a new variable for time in seconds (as measured in 0.5hz, i.e. corresponding to 2 seconds) within trials depending on the variables time as measured in the experiment. Each trial ...
groovyturtle's user avatar
0 votes
1 answer
28 views

r counting the combination of time

This is harder to code, even harder to explain. My apologies if my explanation is confusing, I will try to explain the data this way. I have a dataset with 3 columns ID Vaccine Time 1 ...
Ahir Bhairav Orai's user avatar
0 votes
1 answer
60 views

Create a distribution of immigrants across commune- by country of origin

I would like to transform the table in Stata that I have on the left to the one on the right. I want to calculate the percentage every immigrant has (by nationality) in every commune.
mouad khoubbane's user avatar
-1 votes
2 answers
134 views

Reshape wide data to long format [duplicate]

I am facing trouble reshaping my wide data into a long format using reshape melt.But I couldn't find a solution best suited to my need. Sorry if I am duplicating this question. My monthly data (CSV ...
linux_lover's user avatar
0 votes
1 answer
816 views

Calculating means and sd for different groups [duplicate]

I am trying to calculate means and standard deviations based on groups in a data.frame. Sample Widht Weight Length A1.1 3.5 6.7 5.8 8.3 4.2 6.3 5.5 A1.1 2.9 5.7 5.1 8.3 3.7 6.1 5.4 I have been ...
Lisa Lindberg's user avatar
2 votes
1 answer
230 views

r aggregate or collapse specific column values by id

This may be a duplicate questions. If so, then my apologies, I can delete this question. What I have is a dataset like this ID Color Brand Points 1 Blue Bunny 10 1 Red Bunny ...
Sara U's user avatar
  • 67
2 votes
2 answers
55 views

How to transform from long to wide data set in r by creating means

I have the following data set: Email Relationship Q1 Q2 Q3 Q4 1 [email protected] Self 1 2 2 3 2 [email protected] Peer 3 3 4 5 3 sample@...
Sarita Upadhyay's user avatar
0 votes
0 answers
57 views

Adding and subtracting values from a column between two data frames

I've two dataframes as under: DF1: +-----+---------+-----+-----+ | ID | CURRENT | JAN | FEB | +-----+---------+-----+-----+ | 123 | 2 | 3 | 4 | | 456 | 1 | 5 | 0 | +-----+-------...
user11845701's user avatar
0 votes
3 answers
54 views

Reshaping R dataframe (compute average of a column based on multiple 'level' columns)

I have a R dataframe with this type of structure (Dummy example): df A B C D 1 a 3 5 1 a 5 3 1 b 2 8 2 a 4 7 2 a 6 5 2 b 4 3 ... "A", "B", "C", and "D" are column headers. I want to reshape this ...
user7288808's user avatar
1 vote
1 answer
146 views

How to reshape dataframe and transpose recurring columns to dataframe rows?

I have a dataframe that has recurring columns (the interval is 5). my dataframe at the moment So this is how it looks: I have 5 type of columns and they repeat time over time. The recurring ...
Martiiin's user avatar
2 votes
2 answers
49 views

Aggregate data by year and override NA in row ONLY when value in column for that year

Suppose I have the data frame: dfTest <- data.frame(year = c(1,2,3,1,3), meanVal = c(1,2,3,1,3), var1 = c(1,2,3,1,3), var2 = c(NA,2,NA,1,3), ...
Ellie's user avatar
  • 415
0 votes
2 answers
30 views

Reshaping Routing Data, via Creating subset, in R [duplicate]

I Need to convert this table, creating Cab.ID subsets according to Date, Direction and Route. Date Direction Cab.ID Route Sep 24, 2018 Logout x-1 R1 Sep 24, 2018 Logout x-2 ...
Xenus's user avatar
  • 43
1 vote
2 answers
133 views

Construct a matrix from a database with calculations on r

I am trying to solve the following problem on R. I have a data.framethat looks like this (obviously way bigger): Column_1 Column_2 Column_3 (0-1] (15-25] 58 (2-3] (35-45] ...
A.C.'s user avatar
  • 13

15 30 50 per page