-1

What's a good term for an R value of length 1?

In R, the simplest kind of value is an "atomic" vector with a primitive type like double, but it can have any length, so the term "atomic" is not what I want.

Here's an example: I often want to document my non-vectorized functions to indicate that, for a given argument, we're only interested in a single "value", i.e. something of length one. For instance, a function that sends data to a server would need an argument called url, but I don't want to support sending an arbitrary number of HTTP calls to an arbitrary number of urls. I want url to be an atomic character vector of length 1.

Is there a term for this already in use? Anything better than "of length 1"?

P.S. Note that R functions require these kinds of arguments all the time, like anyNA(x, recursive = FALSE). It would be weird to provide a logical vector like c(TRUE, FALSE, TRUE, FALSE) as a value for recursive. But the docs don't seem to discuss this.

6
  • I'm not really familiar with R, or whatever or not it has an special meaning for "vector" and "of length 1" (I hope it doesn't). However, we have a term for a vector of length one everywhere else: unitary. I suppose you could use it.
    – Theraot
    Commented Jun 20, 2018 at 17:46
  • "unitary" is a great suggestion! Would you mind writing that as an answer and maybe giving a link to example of how it's used elsewhere?
    – Chris
    Commented Jun 20, 2018 at 17:48
  • 3
    Unitary is really an adjective; 'scalar' might be a passable noun if you need one. Commented Jun 20, 2018 at 17:49
  • 1
    downvoters: I'm motivated to be a useful member of the community. Please comment about how I can improve.
    – Chris
    Commented Jun 20, 2018 at 17:59
  • This doesn't seem to have much to do with Software Engineering. It's mostly a vocabulary question. Commented Jun 20, 2018 at 18:41

2 Answers 2

1

The word "unitary" means to have length of 1 (by some metric). For example, in math we talk of an unitary vector (a.k.a unit vector) if - regardless of the number of dimensions - the length of the vector is 1. A similar concept is exist for matrices, unitary matrices represent transformations that preserve the lenght of the vectors. Similarly unitary operators preserve the inner product.

In computer science, a unitrary list is a list of a single element. I have seen the term used more often in logical languages.

Note: unitary list is also a term in politics, for what I understand, when a coalition of political parties promote a single candidate for elections, the list of their candidates is an unitary list.

Contrast the word "unary" that means working with a single element. So, an unary function takes a single argument, and an unary operator is applied over a single value.

However, we do not call "unary vectors" to unidimensional vectors (and we do not call "binary vectors" to bidimensional vectors, for that matter), and the term "unary list" is virtually never used.


1
  • While the "scalar" suggestion is very good, the thing I'm talking about (an R vector) ultimately isn't a scalar (true scalars don't exist in R). "Unitary" describes exactly what I want, as this answer says: "unitary vector (a.k.a unit vector) if - regardless of the number of dimensions - the length of the vector is 1". Thanks!
    – Chris
    Commented Jul 2, 2018 at 20:02
0

Scalar

"A scalar is usually said to be a physical quantity that only has magnitude and no other characteristics. This is in contrast to vectors, tensors, etc. which are described by several numbers that characterize their magnitude, direction, and so on"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.