I am trying to calculate the slope of the below-listed data set ( complete excel file here new_by_particip.csv)
stim_ending_t visbility soundvolume Opening_text Source.Name m sd coefVar
1 1 0 0 Now focus on the Image 001_visual_demo1.csv 2.838282 1.6369315 0.5767333
2 1 0 0 Now focus on the Image 002_visual_demo1.csv 1.502490 0.5223646 0.3476660
3 1 0 0 Now focus on the Image 003_visual_demo1.csv 1.411462 0.6549790 0.4640431
4 1 0 0 Now focus on the Image 003demo_visual_demo1.csv 1.000722 0.2755927 0.2753940
5 1 0 0 Now focus on the Image 004_visual_demo1.csv 1.032277 0.3211426 0.3111013
6 1 0 0 Now focus on the Image 005_visual_demo1.csv 1.300203 0.9841223 0.7568987
Here y = m from the data set, while x = stim_ending_t ( which is a factor of 6 values "1, 1.5, 2, 2.5, 3, 3.5")
Three are three repeated conditions that I want to get the slope for each participant = Source.Name:
What I can do, but it will be very lengthy and tedious work, is to divide the date by each condition in Excel for each participant using =slope function!
Q1: how to calculate the slope for m against stim_ending_t while satisfying the above-mentioned conditions?
Created on 2019-07-25 by the reprex package (v0.3.0.9000)
Each topic here must be about one defined issue, I recommend you to solve your first issue and then ask this question on a new topic providing a REPRoducible EXample (reprex) and making clear what kind of graph you want to do and which are the variables you want to plot.
Hi Andresrcs, Thank you so much for your help that is what I meant! But I used your code on my data set, I got this error Error in model.frame.default(formula = m ~ stim_ending_t, data = .x, drop.unused.levels = TRUE) : variable lengths differ (found for 'stim_ending_t') In addition: Warning message: ... is ignored in group_nest(<grouped_df>), please use group_by(..., add = TRUE) %>% group_nest()
However, when I copied your steps I got the result that I was looking for, any idea why this happened?
Sorry, I have no idea, if you could make a REPRoducible EXample (reprex) about this, we could take a look and try to help. To get sample data that better represents the structure of your actual dataframe try using dput() function (as explained in the reprex link).
Source.Name visbility soundvolume Opening_text slope
001_visual_demo1.csv 0 0 Now focus on the Image 0.533132088
001_visual_demo1.csv 0 0 Now focus on the Sound 0.437678643
001_visual_demo1.csv 0 1 Now focus on the Image 0.443719612
001_visual_demo1.csv 0 1 Now focus on the Sound 0.59256568
001_visual_demo1.csv 1 0 Now focus on the Image 0.651976049
001_visual_demo1.csv 1 0 Now focus on the Sound 0.572769348
002_visual_demo1.csv 0 0 Now focus on the Image 0.740229364
002_visual_demo1.csv 0 0 Now focus on the Sound 0.642380473
002_visual_demo1.csv 0 1 Now focus on the Image 0.66209081
002_visual_demo1.csv 0 1 Now focus on the Sound 0.745573256
002_visual_demo1.csv 1 0 Now focus on the Image 0.826084381
002_visual_demo1.csv 1 0 Now focus on the Sound 0.740139004
When I tried to export the data to .csv file using this code