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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:10:02+00:00 2026-06-16T05:10:02+00:00

I have a csv file (tab deliminated) which contains 2 columns which looks like

  • 0

I have a csv file (tab deliminated) which contains 2 columns which looks like such

5   0
6   0
9   0
8   1
"+5000 lines similar lines"

I am attempting to create a ROC plot using ROCR.

This is what I have tried so far:

p<-read.csv(file="forROC.csv", head=TRUE, sep="\t")
pred<-prediction(p[1],p[2])

The second line gives me an error: Error in prediction(p[1], p[2]) : Number of classes is not equal to 2.
ROCR currently supports only evaluation of binary classification tasks.

I am not sure what the error is. Is there something wrong with my CSV file?

  • 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-16T05:10:03+00:00Added an answer on June 16, 2026 at 5:10 am

    My guess is that your array indexing isn’t setup properly. If you read in that CSV file, you should expect a data.frame (think matrix or 2D array, depending on your background) with two columns and 5,000+ rows.

    So your current call to p[1] or p[2] aren’t especially meaningful. You probably want to access the first and second column of that data.frame, which you can do using the syntax of p[,1] for the first column and p[,2] for the second.

    The specific error you’re encountering, however, is a complaint that the “truth” variable you’re using isn’t binary. It seems that your file is setup to have an output of 1 and 0, so this error may go away once you properly access your array. But if you encounter this in the future, just be sure to binarize your truth data before you use it. For instance:

    p[,2] <- p[,2] != 0
    

    Would set the values to FALSE if it’s a zero, and TRUE for each non-zero cell in the column.

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

Sidebar

Related Questions

Fellow Overflowers, I have a tab delimited csv file which contains dates in this
I have a package which contains a csv file which I put in inst/extdata
I have a csv file that looks something like this (actual file has many
I have a lagre data frame which looks similar to this format: line1 line2<tab>value1
I have a very large csv file that looks like this: keywords,impressions descargar juegos
I have a csv file with records like this: ^Tablete Internet^|GoClever|^TAB I71^|^Tableta GoClever TAB
I have a csv file that looks like this: Please note, there are no
I have a CSV file that looks like this, where time is a UNIX
I have a tab delimited file, that looks like this. chr1 38045559 38046059 C1orf122
I have a malformed tab delimited csv file Name AA BB CC AA BB

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.