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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:22:28+00:00 2026-06-15T15:22:28+00:00

I have a simple csv file containing 2 columns of numbers with the headers

  • 0

I have a simple csv file containing 2 columns of numbers with the headers “Colli_On” and “Colli_Off”. I have written a simple Rscript which passes 3 arguments – file name and column names – and would like to produce a Bland Altman plot. However I get the following error message

> Error in plot.window(...) : need finite 'xlim' values
Calls: baplot ... do.call -> plot -> plot.default -> localWindow -> plot.window
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
3: In min(x) : no non-missing arguments to min; returning Inf
4: In max(x) : no non-missing arguments to max; returning -Inf

Where am I going wrong?

   #!/usr/bin/Rscript
# -*- mode: R =*-

#script passes 3 arguments filename and 2 columns and does bland altman analysis
#Example BA /home/moadeep/Data/sehcat.csv Colli_on Colli_off

args <- commandArgs(TRUE)
mydata <- read.csv(file=args[1],head=TRUE,sep="\t")

baplot = function(x,y){

  bamean = (x+y)/2
  badiff = (y-x)

  plot(badiff~bamean, pch=20, xlab="mean", ylab="difference")
# in the following, the deparse(substitute(varname)) is what retrieves the
# name of the argument as data
  title(main=paste("Bland-Altman plot of collimator x and y\n",
    deparse(substitute(x)), "and", deparse(substitute(y)),
    "standardized"), adj=".5")
#construct the reference lines on the fly: no need to save the values in new 
# variable names
  abline(h = c(mean(badiff), mean(badiff)+1.96 * sd(badiff),
    mean(badiff)-1.96 * sd(badiff)), lty=2)
} 

pdf(file="test.pdf")
baplot(mydata$args[2],mydata$argss[3])
dev.off()
  • 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-15T15:22:29+00:00Added an answer on June 15, 2026 at 3:22 pm

    The problem is with this line:

    baplot(mydata$args[2],mydata$argss[3])
    

    Let’s not even mention the typo… When you ask for mydata$args[2], R looks for a column named “args” in your data.frame. Obviously, there is no such column so you get NULL. The programmatic way of extracting columns from a data.frame is using [. The correct syntax should be:

    baplot(mydata[args[2]],mydata[args[3]])
    

    That should fix your problem.

    (Also note that the [ operator, unlike $, will throw an error if you are trying to extract a column that does not exist: a preferable feature IMHO.)

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

Sidebar

Related Questions

I have a CSV file which contains numbers,date and text. I have to extract
I have a simple text file containing some CSV with the following structure: @Parent1_Field1,
I have created a simple form which is loading a csv file with few
I have a simple python script for indexing a CSV file containing 1 million
I have a simple JSP to download a csv file containing Japanese characters. Downloaded
I have a simple java code that reads text csv file that contains sentences
I have another csv file where I am trying to do a simple word
I have two .csv files containing correlation matrices exported from R. One file contains
I have a UTF-16 CSV file which I have to read. Python csv module
I have written a simple perl script to read a line from a .csv

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.