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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:54:28+00:00 2026-06-13T10:54:28+00:00

I have the following data frame in R: >AcceptData Mean.Rank Sentence.Type 1 2.5 An+Sp+a

  • 0

I have the following data frame in R:

>AcceptData
  Mean.Rank Sentence.Type
1       2.5       An+Sp+a
2       2.6      An+Nsp+a
3       2.1       An+Sp-a
4       3.1      An+Nsp-a
5       2.4       In+Sp+a
6       1.7      In+Nsp+a
7       3.1       In+Sp-a
8       3.0      In+Nsp-a

Which I want to plot, with the Sentence.Type column in the x axis, with the actual name of each cell as a point in the x axis. I want the y axis to go from 1 to 4 in steps of .5

So far I haven’t been able to plot this, neither with plot() not with hist(). I keep getting different types of errors, mainly because of the nature of the character column in the data.frame.

I know this should be easy for most, but I’m sort of noob with R still and after hours I can’t get the plot right. Any help is much appreciated.

Edit:

Some of the errors I’ve gotten:

> hist(AcceptData$Sentence.Type,AcceptData$Mean.Rank)
Error in hist.default(AcceptData$Sentence.Type, AcceptData$Mean.Rank) : 
  'x' must be numeric

Or: (this doesn’t give an error, but definitely not the graph I want. It has all the x values cramped to the left of the x axis)

  plot(AcceptData$Sentence.Type,AcceptData$Mean.Rank,lty=5,lwd=2,xlim=c(1,16),ylim=c(1,4),xla b="Sentence Type",ylab="Mean Ranking",main="Mean Acceptability Ranking per Sentence")
  • 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-13T10:54:30+00:00Added an answer on June 13, 2026 at 10:54 am

    The default plot function has a method that allows you to plot factors on the x-axis, but to use this, you have to convert your text data to a factor:

    Here is an example:

    x <- letters[1:5]
    y <- runif(5, 0, 5)
    
    plot(factor(x), y)
    

    enter image description here

    And with your sample data:

    AcceptData <- read.table(text="
    Mean.Rank Sentence.Type
    1       2.5       An+Sp+a
    2       2.6      An+Nsp+a
    3       2.1       An+Sp-a
    4       3.1      An+Nsp-a
    5       2.4       In+Sp+a
    6       1.7      In+Nsp+a
    7       3.1       In+Sp-a
    8       3.0      In+Nsp-a", stringsAsFactors=FALSE)
    
    plot(Mean.Rank~factor(Sentence.Type), AcceptData, las=2, 
         xlab="", main="Mean Acceptability Ranking per Sentence")
    

    enter image description here

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

Sidebar

Related Questions

I have the following data frame: id<-c(1,2,3,4) date<-c(19970807,19970902,19971010,19970715) df<-data.frame(id,date) in which the type of
I have the following data test<-data.frame(group=1:10, var.a=rnorm(n=10,mean=500,sd=20), var.b=runif(10)) I would like a barplot with
I have the following data: a=c(1:10) b=c(16:25) c=c(24:33) wa=c(3,7,3,3,3,3,3,3,3,1) wb=c(3,2,3,3,3,3,3,3,3,8) wc=c(4,1,4,4,4,4,4,4,4,1) z=data.frame(a,b,c,wa,wb,wc) I want
I have a table that includes the following column: mytable <- data.frame(beta_0 = c(1,2,3)
I have the following data frame and I want to break it up into
I have the following data frame from which I would like to extract rows
I have the following data frame with measurements concatenated into a single column, separated
I have the following data frame and i want to use cast to create
I have the following data frame: id<-c(1,2,3,4) x<-c(0,2,1,0) A<-c(1,3,4,3) df<-data.frame(id,x,A) now I want to
Using python I have created following data frame which contains similarity values: cosinFcolor cosinEdge

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.