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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:45:30+00:00 2026-06-18T07:45:30+00:00

I have a list named d like this: V1 is an integer set from

  • 0

I have a list named d like this:

V1 is an integer set from 0 – 50
V2 is a real set from 1500 – 1800
V3 is an integer set from 1 – 50

In total, the list contains 5100 objects

Now I would like to plot the histogram of V2, with V1 = a certain number (0, 1 or 10, etc.)

I tried different ways:

factor(d$V1)
qplot(V2, data=d, V1 = 1)        --> not successful 
d.subset <- subset(d, d$V1 = 1)  --> not successful

I really get crazy with this. Check the characteristics of d$V1 but found nothing strange. Anyone could help me out?

is.factor(d$V1) 

[1] TRUE

str(d$V1)  Factor w/ 51 levels "1","2","3","4",..: 1 2 3 4 5 6 7 8 9 10 ...

levels(d$V1)  
[1] "1"  "2"  "3"  "4"  "5"  "6"  "7"  "8"  "9"  "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" 
[20] "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31" "32" "33" "34" "35" "36" "37""38" 
[39] "39" "40" "41" "42" "43" "44" "45" "46" "47" "48" "49" "50" "51"
  • 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-18T07:45:31+00:00Added an answer on June 18, 2026 at 7:45 am

    Change the line:

    d.subset <- subset(d, d$V1 = 1)
    

    to

    d.subset <- subset(d, V1 == 1)
    

    Notice the double equals (==) to denote the logical operator. = is used for assignment and doesn’t subset the data frame.

    Finally, you might mean to put the 1 in quotes if you want to get the "1" level of the factor (which might not be the same as the numeric 1).

    d.subset <- subset(d, V1 == "1")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a named list that looks like this: > head(pathways) $<NA> NULL $`2`
So I have xml that looks like this: <todo-list> <id type=integer>#{id}</id> <name>#{name}</name> <description>#{description}</description> <project-id
I have a list like this: <select name=select_list_name id=list_id> <option value=>Select Option</option> <option value=value1>Option
I have the dropdown list like this <?php echo $form->dropdownList($customers,'customer_name', CHtml::listData(Customers::model()->findAll(), 'id', 'customer_name'), array(
I have a structure that roughly looks like this: List<ProductLine> -> ID Name ...
I have an array list named newSymptomList which contains a list of Symptom id's
I have a data.frame like this: (t=structure(list(count = c(NA, 2, NA, NA, NA, 8,
I have array from serial read, named sensor_buffer . It contains 21 bytes. gyro_out_X=((sensor_buffer[1]<<8)+sensor_buffer[2]);
So I have this SQL query, <named-query name=NQ::job_exists> <query> select 0 from dual where
I have a simple set of arrays, kind of like this .. structure shortened

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.