RStudio help with analysis

I hope you can help me.

In a nutshell I’ve got a dataset in excel of 82090 rows (numbered 1-82090) and 11 columns (group, channel 1 to 10).

I’m trying to separate the data into 892 x 92 rows (as 92 rows equals a 10 second time frame and 82090/92 = approx 892) of 11 columns. So that I have a matrix of row 1 to 92 with all columns, then another matrix of row 93 to 185 with all columns etc etc until I have covered all rows to 82090 but only 92 rows at a time.

Then run a linear discriminant analysis (LDA) analysis on each of the 892 separated data sets without doing an LDA on each of the 892 individually and have no idea how to do this or even where to start.

I am a beginner with RStudio**

Got given this script to the question above but don’t understand what ‘df’ is and what is meant by ‘y~x’?

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

Hi,
Attached is a snipping of an excel workbook showing 30 rows and 11 columns of data. The other cells contain the formula used to produce a linear discriminant analysis from the data.
The full data contains 11 columns (group, ch.1,ch.2,ch.3,ch.4,ch.5,ch.11,ch.12,ch.13,ch.14,ch.15) and 82090 rows (numbered in frames). what I need to do is separate the 82090 frames into 92 frame epochs (82090/92=892). This gives 892 epochs of 92 rows and 11 column data sets.

What I need to do in R studio is to separate the data from 82090 rows and 11 columns into 892 lots of 92 rows x 2 columns (Group and Ch.1). For example epoch 1 of 892 would be 2 columns (Group, ch.1) and rows 1-92, group, ch.2 and rows 1-92, group, ch.3 and rows 1-92, group, ch.4 row 1-92, group, ch.5 row 1-92, group,ch.11 row1-92, group, ch.12 row 1-92, group,ch.13 row 1-92, group, ch.14 row 1-92, group, ch.15 row 1-92. So just for epoch 1 there is 10 data sets of 2 columns and 92 rows and an LDA analysis needs to be done on each of the 10 data sets for epoch 1 then the same for the other 891 epochs. I could do this on excel but it would take me ages (each LDA takes about 15 mins and there is 8920 of them).

That is not what I meant, we can't copy from a screenshot, please read the guide I gave you and try to make a proper reproducible example.

I’ll try but have very little knowledge of R or code of any kind. For example, I have no idea what this is or means, “ iris data frame head(iris) #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> 1 5.1 3.5 1.4 0.2…”.

If that is the case then any solution given to you would be like a black box and that is not our goal here. I recommend you to work in your basic R skills, here some free books to get you up and running with R.

I will definitely endeavour to go through this in the future but I’m on a very tight deadline and would need something in laymen’s terms. I can do basics on R like load data, matrices, lda and vectors etc just from following YouTube videos.

Not saying this is an efficient approach, but once you can do the basics you might be able to use all the information provided above to frame a better question regarding what you do and don't understand.

Can you read this data into an R data frame?

Can you extract this subset?

Can you pass the subset from above to an R LDA function?

Hi, Phil_hummel.

I can load the data onto an R script.

I don't know how to extract the subset.

I can do an LDA analysis using R. My main issue is separating rows 1-82090 and 11 columns into 892 epochs of 1-92 rows and 2 columns.

Another issue would be to do an LDA analysis on all 892 epochs quickly (or at the same time if possible).

kind regards,
Steve.

Return rows with matching conditions

Select/rename variables by name

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.