How to identify variables of a dataset? i have a dataset of the annual sales of a bakery and i'm confused about how many variables it has. is it the number of products or the number of years? can someone help me out? thank you!

 A: This could be argued to have seven variables, where six come from the six foods, and one comes from the year. In that sense, each value in the box can be identified by the type of food and the year.
Or it could be three variables: one variable is the type of food, one variable is the year, and one variable is the amount produced of a good in a year.
Both of these are reasonable, and it is a judgment call for which could be best in a given setting. Indeed, even this contingency table could make sense in some settings.
If you find it confusing to interpret a table like this, you might be interested in the Tidyverse and “tidy” data frames. The second of the two ideas I wrote is most aligned with being tidy, though there can be advantages to various ways of representing the data.
A: It has two variables: product and year. The dataset is this:

A dataset like this is usually made to store individual sales. The table you drew is called 'Contingency table' and it records the tally of records with a given combination of variables. The first cell (550) says that there are 550 records with Product='Loaf' and Year='2018', the second cell says that there are 583 records with Product='Loaf' and Year='2019', and so on.
From the contingency table you can make a table with three variables: product, year and sales.

A dataset like this is usually made to record the summary of sales at the end of each year.
