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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:24:20+00:00 2026-06-15T09:24:20+00:00

one quick question picture a data frame like data=data.frame(x=c(1,2,3), y=c(4,5,6), Genes=c(AHS;AKS;AHS,AHS;IO,HU)) so i want

  • 0

one quick question

picture a data frame like

data=data.frame(x=c(1,2,3), y=c(4,5,6), Genes=c("AHS;AKS;AHS","AHS;IO","HU"))

so i want to plot x and y

plot(x,y) 

and do the label for the dots like this

text(data$x+0.2,data$y+0.2,labels=data$Genes)

BUT i dont want to use all arguments from the genes column ONLY the first one (e.g. before the “;”)
Can u please help me with that?
This is only an example, i have already read my data in with read.delim, so i cannot do a specific “read in” with string separation.

  • 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-15T09:24:21+00:00Added an answer on June 15, 2026 at 9:24 am

    As per my comment, you can use gsub to do this:

    gsub('^([A-Z]+);.*$', '\\1', data$Genes)
    

    You could also use strsplit:

    unlist(lapply(strsplit(data$Genes, ';'), '[', 1))
    

    But that’s yucky…

    Its also probably worth mentioning the stringr package which collects a lot of these string munging functions in to a single place with predictable syntax and names.

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

Sidebar

Related Questions

This is a realy quick question One way to update or insert data in
Quick question: if I have an XML like this one: <?xml version=1.0 encoding=utf-8?> <cop
Just a quick question (hopefully). I want to slide one div in front of
Hopefully a very quick question. In one of my functions I want to generate
Just a quick question: I want to use an EnumMap in one of my
Quick question asking for insight from this community: Which one is preferable? Option ①
I'm writing a simple program to convert text to strings. One quick question, how
Hey guys, one more quick question for any experts out there. I have a
When this quick one hour project came up I never thought that 2 days
Just a quick one, hopefully. I've coded up this: <script> $(div.design-project).css('display', 'none'); function InsertContent(tid)

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.