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

  • Home
  • SEARCH
  • 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 8407561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:23:59+00:00 2026-06-09T23:23:59+00:00

I have a dataset in wide form with more than 1500 columns. Since many

  • 0

I have a dataset in wide form with more than 1500 columns. Since many of the variables are repeated I´d like to reshape into long form. However, r throws an error:

Error in guess(varying) : 
  Failed to guess time-varying variables from their names

Trying to understand this with a toy example I find that

u<-data.frame(id=1:100,f.1=rnorm(100),u.1=rnorm(100),i.1=rnorm(100),f.2=rnorm(100),u.2=rnorm(100),i.2=rnorm(100),
                  f.3=rnorm(100),u.3=rnorm(100),i.3=rnorm(100))

reshape(u,varying=2:10,direction="long")

works fine. However, my data looks more like :

u<-data.frame(id=1:100,f1=rnorm(100),u1=rnorm(100),i1=rnorm(100),f2=rnorm(100),u2=rnorm(100),i2=rnorm(100),
              f3=rnorm(100),u3=rnorm(100),i3=rnorm(100))

reshape(u,varying=2:10,direction="long")

and this is where I´m lost. Any smart idea, except of changing the variable names (which is tiring), of how I can do this?

  • 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-06-09T23:24:00+00:00Added an answer on June 9, 2026 at 11:24 pm

    Add the v.names argument:

    reshape(u,varying=2:10,direction="long", v.names=c("f", "u", "i"))
        id time          f          u             i
    1.1  1    1  1.7821678  0.5144692  0.0006889928
    2.1  2    1 -0.5036801  1.8242030  0.9695553817
    3.1  3    1  1.1857706  0.6469423  0.6775602175
    4.1  4    1 -0.5759202 -1.0349980  0.7183451146
    5.1  5    1 -2.3559773  0.8598020  0.5506339475
    6.1  6    1 -0.8047651 -1.4768172 -0.3667918383
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dataset with more than 200 features and I would like to
I have a dataset whose columns look like this: Consumer ID | Product ID
1) long to wide question: I have a dataset with 3 columns: person, event,
I have a dataset with 119 columns separated by a space and like to
I have DataSet which has 3 columns. Name - insurance comp. name - treatmentDate
I have a DataSet where I need to find out how many rows has
I have a DataSet with a DataTable having the columns Number and Description. I
I have a DataSet and I want to convert the DataSet into List<T> T
I have a dataset like: Attic Indoor Indoor Cable Indoor Indoor Double Indoor Indoor
I have a dataset that consists of 6 tables. When I place them into

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.