data manipulaiton

How do I transform the source data into tidy text tibble with: (1) document ID, (2) row number (individual count from 1 to N for each text), (3) word. And using descriptive variable names.

You need to tell us about your source data. Maybe post an example.

It's a document comprised of five different tedx talks

You can read it in with readLines(). Then use dplyr and stringr to arrange it how you want.

Ok. Thank you.

If I may ask another thing:
I have an array of dimensions 5 x 5 x 5
How do I sum up the 1st value in each array?
, , 1

[,1] [,2] [,3] [,4] [,5]
[1,] 8.747092 8.359063 13.023562 9.910133 11.837955
[2,] 10.367287 10.974858 10.779686 9.967619 11.564273
[3,] 8.328743 11.476649 8.757519 11.887672 10.149130
[4,] 13.190562 11.151563 5.570600 11.642442 6.021297
[5,] 10.659016 9.389223 12.249862 11.187803 11.239651

, , 2

      [,1]      [,2]      [,3]      [,4]      [,5]

[1,] 9.887743 12.717359 9.170011 9.670953 8.585010
[2,] 9.688409 9.794425 9.211420 9.493277 10.729164
[3,] 7.058495 10.775343 9.881373 11.393927 11.537066
[4,] 9.043700 9.892390 12.200051 11.113326 9.775308
[5,] 10.835883 7.245881 11.526351 8.622489 11.762215

, , 3

      [,1]      [,2]      [,3]      [,4]      [,5]

[1,] 10.796212 13.960800 14.803236 10.377585 10.951019
[2,] 8.775947 9.265557 9.921520 6.390083 8.580107
[3,] 10.682239 7.911731 11.379479 12.931110 11.221453
[4,] 7.741274 11.139439 10.056004 10.306507 8.131805
[5,] 12.866047 9.729891 8.513454 14.345223 7.492733

, , 4

      [,1]      [,2]      [,3]     [,4]      [,5]

[1,] 10.582892 8.862663 10.665901 8.91496 11.116973
[2,] 9.113416 9.729643 12.126200 12.41574 7.446816
[3,] 10.002211 12.356174 9.391632 12.32081 8.853469
[4,] 10.148683 6.952866 10.740038 11.40043 7.550775
[5,] 8.820958 11.187892 10.534198 13.17367 9.053199

, , 5

      [,1]     [,2]      [,3]      [,4]      [,5]

[1,] 8.759267 13.53457 8.728527 9.214384 8.988085
[2,] 10.084232 11.43341 9.076711 9.360014 12.686078
[3,] 8.178157 11.82035 12.864564 9.441773 9.570841
[4,] 10.316058 10.76837 8.698607 10.988377 9.640887
[5,] 8.690831 13.36435 9.585239 9.645339 9.799619

It would make it easier for everyone if you could read this first, then provide a reproducible example before posting.

The second issue has been listed independently
index array, summation - General - RStudio Community

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.