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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:23:57+00:00 2026-06-18T09:23:57+00:00

I am attempting to use subset to send a row matching a specific value

  • 0

I am attempting to use subset to send a row matching a specific value from a column, but I’m having issues recognizing a specific header I have defined and not another.

foo.csv is:

    ,3ZSJ_ALA_A_142,ED
    1,0,0.249
    2,10,0.379
    3,20,0.542

example r code:

    T1 = read.csv('foo.csv', header=T)
    foo <- subset(T1, 3ZSJ_ALA_A_142 == '10')
    Error: unexpected symbol in "foo <- subset(T1, 3ZSJ_ALA_A_142"
    Execution halted

I have also tried to put the 3ZSJ_ALA_A_142 in parentheses and then my output lis is inappropriate, it should give the row with 10, but it gives this:

    [1] X               X3ZSJ_ALA_A_142 ED  
    <0 rows> (or 0-length row.names)

If I do ED instead of 3ZSJ_ALA_A_142 in my r code I get this lis:

      X X3ZSJ_ALA_A_142    ED 
    2 2              10 0.379

Am I using an inappropriate function, or is my syntax all mucked up? any points would be greatly appreicated, thank you.

  • 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-18T09:23:58+00:00Added an answer on June 18, 2026 at 9:23 am

    Names starting with numbers such as 3ZSJ_ALA_A_142 are not syntactically valid.

    When you call read.csv it has an argument check.names which will check the names for syntactic validity, and adjust if necessary (the default is check.names = TRUE)

    If you are using this to convert to syntactically valid names, then it will (usually) append an X at the beginning of names starting with numerals

    so the following should work.

    foo <- subset(T1, X3ZSJ_ALA_A_142 == '10')
    

    If you don’t want to convert the names, then use check.names = FALSE and use backticks eg ` to refer to the non-syntactic names.

     T2 = read.csv('foo.csv', header=TRUE, check.names = FALSE )
        foo <- subset(T1, `3ZSJ_ALA_A_142` == '10')
    

    Beware using non-syntactic names as some functions may not deal appropriately with them.

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

Sidebar

Related Questions

I'm attempting to use the code from http://www.codeproject.com/Articles/20165/CheckBox-Header-Column-For-DataGridView in order to add a CheckBox
I am attempting to use Kelvin Luck's JScrollPane on my website, but am having
I am attempting to use jQuery Multiple File Upload , but having problems with
I am attempting to use Linq to project each row from a DB query
Attempting to use the data series from this example no longer passes the JSONLint
When attempting to use HttpWebRequest to retrieve a page from my dev server, I
In attempting to use std::select1st from <functional> in a VS2008 project I found that
I am attempting to use the data sources pluigin for rubymine 4.0.3 but I
I'm attempting to use Resources 1.2.RC3, but every time I compile or attempt to
I am attempting to use JSON to send data between the browser and my

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.