Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6975317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:21:09+00:00 2026-05-27T17:21:09+00:00

I have a dataset with several columns, one of which is a column for

  • 0

I have a dataset with several columns, one of which is a column for reaction times. These reaction times are comma separated to denote the reaction times (of the same participant) for the different trials.

For example: row 1 (i.e.: the data from participant 1) has the following under the column “reaction times”

reaction_times
2000,1450,1800,2200

Hence these are the reaction times of participant 1 for trials 1,2,3,4.

I now want to create a new data set in which the reaction times for these trials all form individual columns. This way I can calculate the mean reaction time for each trial.

              trial 1  trial 2  trial 3  trial 4 
participant 1:   2000     1450     1800     2200

I tried the colsplit from the reshape2 package but that doesn’t seem to split my data into new columns (perhaps because my data is all in 1 cell).

Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:21:10+00:00Added an answer on May 27, 2026 at 5:21 pm

    I think you are looking for the strsplit() function;

    a = "2000,1450,1800,2200"
    strsplit(a, ",")
    [[1]]                                                                                                                                                       
    [1] "2000" "1450" "1800" "2200"   
    

    Notice that strsplit returns a list, in this case with only one element. This is because strsplit takes vectors as input. Therefore, you can also put a long vector of your single cell characters into the function and get back a splitted list of that vector. In a more relevant example this look like:

    # Create some example data
    dat = data.frame(reaction_time = 
           apply(matrix(round(runif(100, 1, 2000)), 
                         25, 4), 1, paste, collapse = ","),
                         stringsAsFactors=FALSE)
    splitdat = do.call("rbind", strsplit(dat$reaction_time, ","))
    splitdat = data.frame(apply(splitdat, 2, as.numeric))
    names(splitdat) = paste("trial", 1:4, sep = "")
    head(splitdat)
      trial1 trial2 trial3 trial4
    1    597   1071   1430    997
    2    614    322   1242   1140
    3   1522   1679     51   1120
    4    225   1988   1938   1068
    5    621    623   1174     55
    6   1918   1828    136   1816
    

    and finally, to calculate the mean per person:

    apply(splitdat, 1, mean)
    [1] 1187.50  361.25  963.75 1017.00  916.25 1409.50  730.00 1310.75 1133.75
    [10]  851.25  914.75  881.25  889.00 1014.75  676.75  850.50  805.00 1460.00
    [19]  901.00 1443.50  507.25  691.50 1090.00  833.25  669.25
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have DataSet which has 3 columns. Name - insurance comp. name - treatmentDate
I have a DataSet with several rows and columns (as DataSets tend to have).
I have several datasets i.e. matrices that have a 2 columns, one with a
I have a dataset with one datatable. Now I want to set a filter
We have a Dataset with about 40 TableAdapters on it. These are used everywhere
I have a dataset with multiple tables. One table in particular has one record
I have a SQL Server Database with several tables. One of them has ID
I have a dataset called results with several rows of data. I'd like to
I am newbie to redis, and I have a dataset of several million member
Prelude: I have a large dataset with several hundred thousand records stored in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.