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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:49:06+00:00 2026-06-04T02:49:06+00:00

I have some data that I am not sure how bet to analyze. It

  • 0

I have some data that I am not sure how bet to analyze. It is currently in Excel and will need to fiddling to get to work in R, I am sure. I have a set of targets, their sizes and color. I also have users, the condition and their score for each target.

So the first table look like this:

Target, 1, 2, 3, 4, 5 ...
Size,   L, M, L, S, L ...
Color   R, B, G, B, R ...

Then I have all the user data that has a column for the user id, a column for the device, then a column for the score on each target.

User, Condition, 1, 2, 3, ...
1     A          5, 2, 8, ...
1     D          2, 4, 6, ...
2     A          1, 4, 6, ...
2     B          5, 8, 3, ...

I mainly want to run an ANOVA between the 4 conditions so see if the mean scores are the same on L targets, or R targets for example.

I have never had to use a 2nd table to filter or look up data like this. How do I 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-04T02:49:08+00:00Added an answer on June 4, 2026 at 2:49 am

    Quick and dirty solution (because I believe someone will certainly propose a more elegant solution avoiding loop):

    tab1 <- list(Target=1:5, Size=c("L","M","L","S","L"), Color=c("R","B","G","B","R"))
    tab2 <- data.frame(rep(1:2, each=2), c("A","D","A","B"),
                       c(5,2,1,5), c(2,4,4,8), c(8,6,6,3))
    names(tab2) <- c("User", "Condition", 1:3)
    
    library(reshape)
    tab2.melt <- melt(tab2, measure.vars=3:5)
    
    for (i in 1:nrow(tab2.melt)) {
      tab2.melt$Size[i] <- tab1$Size[tab1$Target==as.numeric(tab2.melt$variable[i])]
      tab2.melt$Color[i] <- tab1$Color[tab1$Target==as.numeric(tab2.melt$variable[i])]    
    }
    

    I am assuming you are able to import your data into R, but you may want to adapt the above code if the data structure isn’t the one you show in your excerpt. Basically, the idea is to consider your Target code as a way to index Size and Color levels, which we need in the final data.frame for each repeated measurement (on the ith subject).

    The updated data.frame looks like:

    > head(tab2.melt)
      User Condition variable value Size Color
    1    1         A        1     5    L     R
    2    1         D        1     2    L     R
    3    2         A        1     1    L     R
    4    2         B        1     5    L     R
    5    1         A        2     2    M     B
    6    1         D        2     4    M     B
    

    From there, you can perform a 3-way ANOVA or study specific contrasts.

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

Sidebar

Related Questions

I have some data that won't printf.... echo works, but not printf There is
I have some data with start and stop date that I need to sum.
So I have a bookmarklett that seems to not work on some sites. Here's
I am currently trying to decompress some data that I have coming in with
I have some HIGHLY sensitive data that I need to expose to Android and
I have created an Excel Sheet that does some lookups to format data that
I have some data that is stored in a TIMESTAMP(6) WITH TIMEZONE column in
I have some data that I would like to visualize. Each byte of the
I have some data that I am displaying in 3 column format, of the
I have some data that has various attributes and I want to hierarchically group

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.