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 4107346
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:29:54+00:00 2026-05-20T21:29:54+00:00

I am currently analysing a rather large dataset (22k+records) and am having some trouble

  • 0

I am currently analysing a rather large dataset (22k+records) and am having some trouble getting the data into a wide format (with one row corresponding to each observation, and columns representing variables).

The data came in two CSV files, one giving demographics and the other giving participants probability ratings to a number of questions. Both of these CSV files were in long format.

I have used the reshape (and reshape2 for speed) packages to attempt to solve my problem. The specific issue i am having is the following.
I have the participants probability ratings in the following form (after one successful reshape).

dtf <- read.csv("http://dl.dropbox.com/u/8566396/foobar.csv")

Now, the format i would like my data to be in is as follows:
User ID Qid1, ….Qid255 Time, with the probabilities for each question in the questions corresponding column.

I have tried a loop and apply to put the values into a new data frame, and many variations of melt and cast. I have also tried the base reshape function, but all to no avail.

In the past, i’ve always edited my CSV files directly, but this is not an option with the size of this file (my laziness when it comes to data manipulation within R has come back to haunt me).

Any advice or solution you can give to avoid me having to do this by hand would be greatly appreciated.

  • 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-20T21:29:54+00:00Added an answer on May 20, 2026 at 9:29 pm

    Your dataset has 6 rows, 3 of which have the column “variable” equal to “probability” and 3 of which have that column equal to “time”. You want to have probability be the value of each, and time be added onto the right.

    I think there’s a difficulty in making this work for you because what you want to do isn’t clear. You have values for each UID-Time-X### cell, and values for each UID-Prob-X### cell. Therefore, you have to discard information to get it into your preferred format (UID-Time-X### with probabilities as the values). It seems to me like you’re treating time as an ID variable, but it’s storing values like a content variable.

    To avoid discarding any data, your output would have to look something like:
    UID Time1 Time2 Time3 Prob1 Prob2 Prob3

    Which is simply reshaped wide.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Scenario: I load some data into a local MySQL database each day, about 2
I'm currently trying to analyze large data sets (40 000+ data points) with matlab.
I am currently doing some research which involves analyzing data coming from different sensors.
I an a graduate student of nuclear physics currently working on a data analysis
The website that I'm currently working on is having a few issues with Webkit
Problem domain I'm working on a rather big application, which uses a hierarchical data
I am currently doing my graduate studies with focus on data analysis/informatics in research
I am writing some data analysis software, I want to upscale timebase of my
I'm currently working on this project that implies some DSP skills. I must extract
Confused by private bytes! Currently analysing the memory usage of our C# .NET application

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.