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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:35:36+00:00 2026-05-26T21:35:36+00:00

This works. ok <- function(data) { lattice:::bwplot(size ~ mxPH, data=data) } > ok(algae) ##

  • 0

This works.

ok <- function(data)
{
    lattice:::bwplot(size ~ mxPH, data=data)
}

> ok(algae)
## no error

I’d like to specify size and mxPH by its column numbers. However, the following didn’t work.

1st attempt

aa <- function(data, n1, n2)
{
    names <- names(data) 
    lattice:::bwplot(names[n1] ~ names[n2], data=data)
} 

> aa(algae,2,4)
Warning message:
In function (x, y, box.ratio = 1, box.width = box.ratio/(1 + box.ratio),  :
  NAs introduced by coercion

2nd Attempt (small modification to the 1st one)

bb <- function(data, n1, n2) 
{       
    names <- factor(names(data))
    lattice:::bwplot(names[n1] ~ names[n2], data=data)
} 

> bb(algae,2,4)
## no error

3rd Attempt (small modification to the 2nd one)

cc <- function(data, n1, n2)
{   
    names <- factor(names(data))
    lattice:::bwplot(deparse(substitute(names[n1])) ~ deparse(substitute(names[n2])), data=data)
}

> cc(algae,2,4)
Warning message:
In function (x, y, box.ratio = 1, box.width = box.ratio/(1 + box.ratio),  :
  NAs introduced by coercion


Data

algae <- utils:::read.table('http://www.liaad.up.pt/~ltorgo/DataMiningWithR/DataSets/Analysis.txt',
         header=F,
         dec='.',
         col.names=c('season','size','speed','mxPH','mnO2','Cl','NO3','NH4','oPO4','PO4','Chla','a1','a2','a3','a4','a5','a6','a7'),
         na.strings=c('XXXXXXX'))
  • 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-05-26T21:35:37+00:00Added an answer on May 26, 2026 at 9:35 pm
    library(lattice)
    bwplot.column <- function(data, n1, n2, xlab = NULL, ylab = NULL, ...)
    {
      if (is.null(ylab)) {
        ylab <- names(data)[n1]
      }
    
      if (is.null(xlab)) {
        xlab <- names(data)[n2]
      }
    
      bwplot(data[,n1] ~ data[,n2], xlab = xlab, ylab = ylab, data = data, ...)
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function i would like to run onChange. This works fine with
This matrix transposition function works, but I'm trying to understand its step by step
This works fine: $.getJSON(http://localhost:59396/xxxWeb/ CarouselHandler.ashx?action=getproducts&ids= + ids, function(data) { carousel.size(allProductIDs.length); if (numberOfImagesLeftToShow < numberOfImagesToDisplay)
This works in jQuery 1.3.2, but not in 1.4 $(#container).children().map(function() { var child =
This works fine: [655971, 2343, 343].map(function(x) { return parseInt(x) }) // [655971, 2343, 343]
I'm using a javascript function to submit my form. This works in every browser
$.post($(this).attr(action), $(this).serialize(), function(json) { alert('red'); AddItemAjax(json); }, json); This works in Chrome but not
This code always works, even in different browsers: function fooCheck() { alert(internalFoo()); // We
I am using this jquery function that works fine in win/mac FF 3.5 and
I have this jQuery which works fine $(li[id^='shop_id']).click( function () { alert(I clicked on

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.