Find Image Location in a Given Set of Locations

Description

This function determines the location of an image within a set of locations. The function accepts a vector of locations (such as "TL", "TR", "BL", "BR") and an image identifier. It returns the corresponding location name if the image is found, or β€˜NA’ if the image is not present or is β€˜NA’.

Usage

find_location(locations, image)

Arguments

locations A character vector representing the possible locations (e.g., β€˜c("TL", "TR", "BL", "BR")’).
image A character value representing the image to find in the locations.

Value

A character string representing the location of the image, or β€˜NA’ if the image is not found or is missing.

Examples

library("webgazeR")

# Example usage of the find_location function
locations <- c("apple", "banana", "cherry", "date")
find_location(locations, "banana")  # Returns "TR" if locations follow c("TL", "TR", "BL", "BR")
[1] "TR"
find_location(locations, "orange")  # Returns NA
[1] NA