1.9: Water Use
It is amazing what water is used for and how much is used on a daily basis. We tend to not think about all the daily activities we do which requires the use of water. We turn on the faucet in the morning without giving it much thought. We flush the toilet, make coffee, and shower without the consideration of where or how the water comes out of our tap. If we think about the simple and obvious water uses, we might list washing our face and hands, taking showers or baths, brushing our teeth, making coffee, boiling pasta, washing dishes and clothes, flushing toilets. However, the list of water use goes on and on. In addition to the obvious uses (i.e., drinking, bath, irrigation, etc.) millions of gallons are used in the manufacturing and processing of everything from semiconductors to beer and everything in between. Water is a vital resource for public health and safety and plays a significant role in our economy. One of the largest water uses in California is the agriculture industry. According to the Pacific Institute’s 2009 report titled Sustaining California Agriculture in an Uncertain Future , approximately 17.2 million acre-feet of water is used for agriculture annually. In addition, a large portion of the state’s water supply is undeveloped and used for environmental purposes.
Water use can be broken down into several different categories: geographic, socioeconomic, availability, reliability, and quality. Geographically where water is plentiful very little is used for outdoor irrigation and sometimes use isn’t even tracked. In contrast, in areas of the world where precipitation is low and water is scarce, it is treated differently and very little is used for outdoor irrigation. In poorer areas of the globe, water is a vital resource for survival. Approximately one (1) billion people lack safe and adequate water. In these regions people are not concerned with keeping a lawn green with water. They are worried about surviving. Availability, reliability, and the quality of water also play an important role in usage patterns. Industrialized countries tend to have water readily available, with reliable infrastructure, and of high quality. However, as we have seen in recent years, in certain areas, such as Australia and California, long droughts can occur, jeopardizing water availability, reliability, and quality. The point of this introduction is not to memorize facts and figures; it is to illustrate the vast amount of water uses and variability of supplies throughout the world. The remainder of this chapter will focus on common water uses primarily in California. As mentioned above, water plays an important role in the manufacturing of items. The following table is an example of how much water is needed to prepare certain items.
|
ITEM |
GALLONS OF WATER |
|
Pair of Jeans |
1,800 |
|
Cotton T-Shirt |
400 |
|
Barrel of Beer (32 gallons) |
1,500 |
|
Single Board of Lumber |
5.4 |
|
Gallon of Paint |
13 |
|
Individual Plastic Bottle of Water |
1.85 |
Units of Water
Whenever we discuss water we talk in volumes. However, there are various units to measure volumes of water. Each unit has its own purpose and are commonly interchanged with each other. Below is a partial list of units and the common use for reporting.
|
USE |
UNIT |
|
Meter Reads |
Cubic feet (cf) Hundred cubic feet (HCF / CCF) |
|
Groundwater Well Flow |
Gallons per minute (gpm) |
|
Daily Production |
Million gallons per day (MGD) |
|
Annual Production |
Acre-feet per year (AFY) |
|
Per Person |
Gallons per capita per day (GPCD) |
Understanding the terminology and units used in any industry is very important. The water industry uses a variety of different units and has a lot of terms not used in any other industry. As you start taking more classes in this field and begin your career in water you will become acquainted with the “language” of the industry.
As shown in the above table, the common unit of measure to track water use on a per person basis is “gpcd”, which is gallons per capita (per person) per day. This is the amount of water used by one person per day. It is typically calculated by taking the total water demand (use) for the year and dividing it by the total population served. This will give you the amount of water each person uses for one year. Dividing it by 365 (the number of days in a year) will yield the gpcd, the gallons per person (per capita) per day. This number and unit were not used very often in the industry prior to 2009. In 2009, the governor of California passed legislation for conserving water and one of the parameters used to measure the required amount of conservation required by water suppliers is gpcd. Senate Bill X7-7 requires water suppliers to conserve at least 20% of their water demand by the year 2020. Hence, the bill is commonly referred to as 20x2020 (20 by 2020).
In order to conserve water it is important to identify water use. Where is the water being used? This may seem like an obvious statement, but being able to identify where the most water is being used can help in targeting specific areas for conservation. For example, gpcd includes both indoor and outdoor water use from residential customers. As previously stated, it is simply the total amount of water used divided by the total population. However, it doesn’t distinguish between indoor or outdoor water uses. It also doesn’t discern between other uses such as business or industry (these will be discussed later in the text.) In the next section we will analyze and assume the entire population of the first few examples is a residential community. Therefore, the gpcd would be for all residential water use both inside and outside the home.
GPCD
Water usage varies from person to person, city to city, state to state, and more importantly climate to climate. Geography and socioeconomic status also plays an important role with water use. Little irrigation water is needed in areas with high amounts of precipitation. However, sometimes in areas with very little precipitation, little is used for outdoor irrigation too. For example, the gpcd for someone living in an area where there is a lot of annual precipitation will more than likely have a lower gpcd than compared to someone living in a warmer climate. Socioeconomic status will also have an effect on water use and gpcd. A single person living alone in a small apartment will probably have a lower gpcd than someone living in a Beverly Hills mansion with a large yard. Someone with high efficiency appliances, low flow toilets and faucets would tend to have a lower gpcd than someone with access to these types of things. Below is an example of the differences between geographic regions and the respective gpcd values.
|
Average Daily Per Capita Water Use in Several Major U.S. Cities |
|
|
Metropolitan Area |
GPCD |
|
Phoenix, AZ |
115 |
|
New York, NY |
78 |
|
Seattle, WA |
52 |
|
Sacramento, CA |
280 |
|
San Diego, CA |
143 |
Before even looking at the actual gpcd values in the above table, you could probably guess which city would have the lower and which would have the higher average gpcd values. The only city which may have tricked a few people could possibly be Phoenix, Arizona. Phoenix is a very hot and arid city and one might expect a very high gpcd. However, the gpcd value is considerably lower to a similarly hot and arid Sacramento community. Why is this? If you have ever traveled to Phoenix and Sacramento, the difference between most of the homes in Sacramento compared to Phoenix is the type of landscaping at an average sized single family home. In Phoenix, many homes have “native” or natural landscaping such as rocks and cactus. In contrast, many Sacramento homes have grass (turf) for landscaping. There are other reasons why Sacramento has a higher gpcd than Phoenix, but this is one of the more obvious reasons. Water use is dependent on availability, reliability, and quality.
Let’s now take a look at a hypothetical gallon per capita per day (gpcd) calculation to
work with as an example to identify water use. Typically when a gpcd is calculated it is not done based on individual water usage. It is commonly calculated based on total annual consumption divided by the total population served. Assume a population of 5,000 people uses 1,120 acre-feet of water in one year. What would be the gpcd for this hypothetical community? Using the formula “total gallons divided by total population”, converts to a gpcd of approximately 200 (see below).
1 AF = 325,829 gallons
1,120 AFY x 325,829 gallons = 364,928,480 gallons per year
364,928,480 gallons / 5,000 people = 72,986 gallons per person per year
72,986 gallons per person per year / 365 days = 200 gpcd
This type of calculation will be discussed in more detail in the Water 031 Advanced Waterworks Mathematics course. Therefore, you will not be required to perform this type of calculation in this course. It is used as an example and to help explain how water use is calculated and identified. Now that we have an example gpcd, let’s break down the actual usage.
California
Among all the countries in the world, the United States has the highest average daily water use per person. In fact, on average, the U.S. uses approximately 410 billion gallons of water per day. The majority of this water use comes from surface supplies; about 80% and the remaining 20% comes from groundwater. Thermoelectric power is responsible for approximately half of all U.S. water demand. Irrigation (agriculture) and public water supply makes up just about all the remaining.
California water use is strongly dependent on the Mediterranean climate throughout much of the state. However, California also has some very tall mountain ranges with subarctic conditions. The lower flatland areas of California consist of long dry summers, cool evenings, and mild rainy winters. This is why so many people flock to areas in Southern California. A summer day in Santa Monica or San Diego is almost the perfect climate condition; warm (not hot) days and cool evenings. Many of the mountain areas throughout the state experience a more traditional four-season year with snow lasting from November to April. However, because California is a coastal state, the climate is also dependent on the conditions of the Pacific Ocean. This means, there can be times of significant drought and also high amounts of rainfall during weather conditions such as El Nino.
Because of California’s unique size and location, there are four (4) main climate regions; Central Coast, Mountain, Central Valley, and Imperial Valley. These four (4) regions have very diverse climate conditions. The Central Coast has more mild than hot summers and more mild than cold winters. Think of San Francisco as an example. The summers in San Francisco are not typically too hot and the winters are not extremely cold. The mountainous regions of California also have typically mild summers. However, in contrast the winters can be very cold with high amounts of rain and snow. The Central Valleys usually experience very hot summers and cool winters. The San Joaquin Valley for example can have summer temperatures, which exceed 100F and also see some snow in the winter. The Imperial Valley (e.g. Palm Springs) is very hot and dry in the summer and the winters are typically very mild with little to no rainfall.
Most of the rain and snow occurs in the eastern and northern portions of California. While most of the people live along the coast and southern portions of the state. This presents a unique distribution challenge for water professionals. Bringing water from where it is to where most of the people are is something California does quite well. However, during years of drought the ability to distribute water throughout the state can be costly and difficult. Most of the time there are ample supplies of water in California for all of the various uses. During extremely wet years, there is sometimes too much water and not enough storage and a lot of the supply ends up in the Pacific Ocean.
Indoor Water Use
In this section we will analyze some potential indoor residential water use and compare it to the 200 gpcd we calculated in the previous section. If indoor and outdoor uses are not metered separately, certain assumptions will have to be made to distinguish between the two main areas of use. A lot of research and study has gone on and continues regarding water use. In January 2010, the California Homebuilding Foundation published a document titled “Water Use in the California Residential Home”. Many of the estimates used in this section were collected from this document. However, it is important to note this is a “fluid” topic (pun intended) and regulations and policies are constantly changing when it comes to water use and conservation.
Now that we have established a 200 gpcd for this example community, we know how much water each person uses on an average per day. There are a number of variables affecting the actual use per individual, but this is the actual average gpcd for this example. Once the average gpcd is calculated you can break down the usage. First, let’s identify typical indoor uses. There are a number of different indoor water uses. For example, flushing toilets, brushing your teeth, bathing, washing your hands, cooking, cleaning dishes, and cleaning clothes. In addition to these common uses a certain amount of water can be lost through leaks in the plumbing system. There are obvious leaks such as a broken pipe or fixture. However, some leaks can go undetected for days or possibly longer. Toilets are probably some of the more common areas where leaks occur. The slightest little crease or crack in the rubber seal in the toilet tank can cause water to slowly drip into the bowl without being noticed. This is just one example of leaks which can account for a high percentage of water use both indoors and outdoors. The list of indoor water use can be larger, but this is a good start. Look at the table below for some estimated amounts and volumes of indoor water use.
|
USE |
AMOUNT (%) |
Volume per Use |
Time/Quantity of Use |
TOTAL based on 200 gpcd |
|
Bathing |
8% |
2.5 gpm |
8 min |
16 gal |
|
Toilets |
3% |
1.6 gpf |
4 |
6.4 gal |
|
Faucets (cooking/washing) |
6% |
2.2 gpm |
5.5 min |
12.1 gal |
|
Clothes Washer |
2% |
1 load per week |
25.5 per load |
3.6 gal |
|
Other/Leaks |
8% |
16 gal |
||
|
Total Gallons per Day |
54.1 gpd |
Based on the information in the above table, the indoor usage would account for approximately 27% of a person’s usage with a 200 gpcd. This is to say 54.1 gallons of indoor water use divided by a total water use of 200 gpcd equates to about 27%. If 27% is identified as indoor water use, then the outdoor (or irrigation) usage would account for approximately 73% or 145.9 gallons per day.
In the space below, make a list of your various indoor uses and estimate how much water you use per day in your home.
Use Time or Frequency Volume
Outdoor Water Use
Sticking with the same 200 gpcd example, the average outdoor water use equates to approximately 73% or 146 gpcd. In California, the average outdoor residential water use ranges from approximately 60 - 75%. Most of this water is used to keep lawns green. Drive around any single family residential community in California and you’ll see acres and acres of turf. This green lush landscaping requires significant amounts of water to keep it green, especially in some of the dry semi-arid inland communities across the state. However, in 2015, the State Water Resources Control Board (SWRCB) adopted water conservation regulations mandating urban water suppliers to reduce water consumption on average of 25%. In addition, new home building standards are becoming stricter making it almost impossible to install grass as the normal focal point in front and backyards throughout California. As usage patterns change, there are still millions of homes with front and backyards covered in grass. So, how much water is used to irrigate a lawn. New efficient drip, micro-spray, and irrigation systems are coming out every day, but many outdoor irrigation systems use standard “sprinkler heads.” The amount of water sprayed out of a sprinkler head varies, but the average nozzle produces approximately four (4) gallons of water per minute. Let’s look at a hypothetical example.
Assumptions:
- 1 sprinkler head produces four (4) gallons per minute
- 7 sprinkler heads per irrigation station
- 5 irrigation stations
- Each station operates for 10 minutes per day
Based on the assumptions above, let’s calculate how much water this irrigation system produces in one day.
7 sprinkler heads x 4 gallons per minute per head = 28 gallons per minute
28 gallons per minute x 10 minutes = 280 gallons per station
280 gallons per station x 5 stations = 1,400 gallons per day
You can see by this example, the amount of water used for outdoor irrigation can add up in a hurry. In fact, based on the 200 gpcd example we used in the above example this would equate to a much higher gpcd. One other thing needs to be mentioned regarding the 200 gpcd. Remember, this is for one person. Someone with the irrigation system used in the above example may be from a family’s home. So, let’s assume the irrigation system is from a family of four (4) and they are not watering daily. Let’s assume they are watering three (3) days per week. How does this look in terms of a gpcd?
First, take the 200 gpcd and multiply it by a family of four (4).
200 gpcd x 4 = 800 gpcd for this home
Next, take the 1,400 gallons per day, multiply it by three (3) days a week and then divide it by seven (7) days a week to get the per day amount.
1,400 gpd x 3 days = 4,200 gallons per week
4,200 gpw / 7 days in a week = 600 gallons per day
The 600 gallons of outdoor water use is for the entire family of four. As a percentage, this equates to approximately 75%, which is consistent to the example given above.
Now, divide this by four (4) for the family.
600 gallons per day / 4 people = 150 gallons per person per day
Therefore, in this example, one (1) person uses 200 gallons per day with 150 coming from outdoor uses and 50 from indoor uses. If you remember the indoor usage calculated in the earlier example it was 54.1 gallons, similar to the results in this exercise. Please note that this is just one example in a very complex and diverse world, but it should illustrate the point of how indoor and outdoor uses can be estimated.
Other Water Uses
This section will focus on other uses in California. The California Department of Water
Resources (DWR) breaks down California’s total water use into three (3) main broad categories: Urban, Agricultural, and Environmental uses. Urban use includes domestic residential use as previously described. In addition, urban water use includes commercial, industrial, and institutional uses. These three (3) categories make up a component of water use in California and throughout the world. In California, these use categories are defined by the DWR.
- Commercial: Water users that provide or distribute a service.
- Industrial: Any water users that are primarily manufacturers or processors of materials as defined by the Standard Industrial Classifications (SIC) Code.
- Institutional: Any water using establishments dedicated to public service. This includes schools, courts, churches, hospitals, and government facilities.
As you can imagine, the use percent for these three (3) categories can vary widely based on the area. For example, the amount of commercial, industrial, and institutional water use in a small “bedroom” community would be quite low. However, in a city such as San Pedro, California, where there are a variety of industries this component of usage can be quite high. In California, these categories only account for a small percentage of all urban water use.
Agricultural and Environmental Water Use
In California, it is estimated that the agriculture industry accounts for approximately four (4) times as much water use as all urban water uses. This is not surprising since California’s unique geography and Mediterranean climate have allowed the State to become one of the most productive agricultural regions in the world. California produces over 250 different crops and leads the nation in production of 75 commodities. California agriculture irrigates approximately 9.6 million acres of land. Environmental uses are identified as coming from developed and undeveloped water supplies. A developed water supply is one controlled and operated by someone. For example, the State Water Project is a developed water supply controlled and operated by DWR. It comes from natural runoff from precipitation and snow melt runoff, but it has been developed into a supply for specific uses. In contrast, an undeveloped supply would be a “free” flowing stream or river which is not used for specific uses. Both of these supplies are used for and by the environment. Among other things, developed flows are needed to keep salinity levels lower in the Sacramento Bay-Delta area and to help keep cold, clean water needed for salmon migration and spawning. According to DWR, roughly 52 percent is used for agriculture, 14 percent for urban, and 33 percent for environmental uses.


7.8: Female Reproductive System Learning Activities
Interactive Learning Activity: Label the anatomy of the female reproductive system.
Query \(\PageIndex{1}\)
Interactive Learning Activity: Study female reproductive system medical terms discussed in this chapter.
Query \(\PageIndex{2}\)
Interactive Learning Activity: Test your knowledge on terms related to the female reproductive system.
Query \(\PageIndex{3}\)
Interactive Learning Activity: Using the sample documentation provided, drag the terms on the right to their appropriate spaces within the documentation.
Query \(\PageIndex{4}\)
Interactive Learning Activity: Using the sample documentation provided, drag the terms on the right to their appropriate spaces within the documentation.
Query \(\PageIndex{5}\)
Interactive Learning Activity: Using the sample documentation provided, drag the terms on the right to their appropriate spaces within the documentation.
Query \(\PageIndex{6}\)
Interactive Learning Activity: Practice identifying and defining word parts for terms discussed in this chapter.
Query \(\PageIndex{7}\)
You can also print this as a Chapter 7 Practice Worksheet and check your answers with this Answer Key PDF .


18.4: Self-Regulation and Self-Efficacy
-
- Last updated
- Save as PDF
Self-regulation and self-efficacy are two elements of Bandura’s theory that rely heavily on cognitive processes. They represent an individual’s ability to control their behavior through internal reward or punishment, in the case of self-regulation, and their beliefs in their ability to achieve desired goals as a result of their own actions, in the case of self-efficacy. Bandura never rejects the influence of external rewards or punishments, but he proposes that including internal, self-reinforcement and self-punishment expands the potential for learning:
…Theories that explain human behavior as solely the product of external rewards and punishments present a truncated image of people because they possess self-reactive capacities that enable them to exercise some control over their own feelings, thoughts, and actions. Behavior is therefore regulated by the interplay of self-generated and external sources of influence… (pg. 129; Bandura, 1977)
Self-regulation is a general term that includes both self-reinforcement and self-punishment. Self-reinforcement works primarily through its motivational effects. When an individual sets a standard of performance for themselves, they judge their behavior and determine whether or not it meets the self-determined criteria for reward. Since many activities do not have absolute measures of success, the individual often sets their standards in relative ways. For example, a weight-lifter might keep track of how much total weight they lift in each training session, and then monitor their improvement over time or as each competition arrives. Although competitions offer the potential for external reward, the individual might still set a personal standard for success, such as being satisfied only if they win at least one of the individual lifts. The standards that an individual sets for themselves can be learned through modeling. This can create problems when models are highly competent, much more so than the observer is capable of performing (such as learning the standards of a world-class athlete). Children, however, seem to be more inclined to model the standards of low-achieving or moderately competent models, setting standards that are reasonably within their own reach (Bandura, 1977). According to Bandura, the cumulative effect of setting standards and regulating one’s own performance in terms of those standards can lead to judgments about one’s self. Within a social learning context, negative self-concepts arise when one is prone to devalue oneself, whereas positive self-concepts arise from a tendency to judge oneself favorably (Bandura, 1977). Overall, the complexity of this process makes predicting the behavior of an individual rather difficult, and behavior often deviates from social norms in ways that would not ordinarily be expected. However, this appears to be the case in a variety of cultures, suggesting that it is indeed a natural process for people (Bandura & Walters, 1963).
As noted above, “ perceived self-efficacy refers to beliefs in one’s capabilities to organize and execute the courses of action required to produce given attainments ” (Bandura, 1997). The desire to control our circumstances in life seems to have been with us throughout history. In ancient times, when people knew little about the world, they prayed in the hope that benevolent gods would help them and/or protect them from evil gods. Elaborate rituals were developed in the hope or belief that the gods would respond to their efforts and dedication. As we learned more about our world and how it works, we also learned that we can have a significant impact on it. Most importantly, we can have a direct effect on our immediate personal environment, especially with regard to personal relationships. What motivates us to try influencing our environment is specific ways is the belief that we can, indeed, make a difference in a direction we want. Thus, research has focused largely on what people think about their efficacy, rather than on their actual ability to achieve their goals (Bandura, 1997).
Self-efficacy has been a popular topic for research, and Bandura’s book Self-Efficacy: The Exercise of Control (1997) is some 600 pages long. We will address two key issues on this fascinating topic: the relationships between (1) efficacy beliefs and outcome expectancies and (2) self-efficacy and self-esteem . In any situation, one has beliefs about one’s ability to influence the situation, and yet those beliefs are typically balanced against realistic expectations that change can occur. Each side of the equation can have both negative and positive qualities. Suppose, as a student, you are concerned about the rising cost of a college education, and you would like to challenge those rising costs. You may believe that there is nothing you can do (negative) and tuition and fees will inevitably increase (negative). This dual negative perspective leads to resignation and apathy, certainly not a favorable situation. But what if you believe you can change the college’s direction (positive), and that the college can cut certain costs in order to offset the need for higher tuition (positive). Now you are likely to engage the college community in productive discussions, and this may lead to personal satisfaction (Bandura, 1997). In the first scenario, you are not likely to do anything, in the second scenario you will most likely be highly motivated to act, even energized as you work toward productive changes. Of course, there are two other possible scenarios. You may believe there is nothing you can do (negative), but that change is possible (positive). In this case, you are likely to devalue yourself, perhaps feeling depressed about your own inability to accomplish good. Conversely, you may believe there is something you can do (positive), but that external forces will make change difficult or impossible (negative). This may lead some people to challenge the system in spite of their lack of expected change, resulting in protests and other forms of social activism (Bandura, 1997). Since all of these scenarios are based on beliefs and expectations, not on the unknown eventual outcome that will occur, it becomes clear that what we think about our ability to perform in various situations, as well as our actual expectations of the consequences of those actions, has both complex and profound effects on our motivation to engage in a particular behavior or course of action.
As for self-efficacy and self-esteem, these terms are often used interchangeably, and on the surface that might seem appropriate. Wouldn’t we feel good about ourselves if we believed in our abilities to achieve our goals? In fact, self-efficacy and self-esteem are entirely different:
…There is no fixed relationship between beliefs about one’s capabilities and whether one likes or dislikes oneself. Individuals may judge themselves hopelessly inefficacious in a given activity without suffering any loss of self-esteem whatsoever, because they do not invest their self-worth in that activity. (pg. 11; Bandura, 1997)
For example, my family was active in the Korean martial art Taekwondo. Taekwondo emphasizes powerful kicks. Because I suffer from degenerative joint disease in both hips, there are certain kicks I simply can’t do, and I don’t do any of the kicks particularly well. But I accept that, and focus my attention on areas where I am successful, such as forms and helping to teach the white belt class. Likewise, Bandura notes that his complete inefficacy in ballroom dancing does not lead him into bouts of self-devaluation (Bandura, 1997). So, though it may improve our self-esteem to have realistic feelings of self-efficacy in challenging situations, there is not necessarily any corresponding loss of self-esteem when we acknowledge our weaknesses. And even positive self-efficacy might not lead to higher self-esteem when a task is simple or unpleasant. To cite Bandura’s example, someone might be very good at evicting people from their homes when they can’t pay their rent or mortgage, but that skill might not lead to positive feelings of self-esteem. This concept was the basis for the classic story A Christmas Carol , featuring the character Ebenezer Scrooge (Charles Dickens, 1843/1994).
The Development of Self-Efficacy
Young children have little understanding of what they can and cannot do, so the development of realistic self-efficacy is a very important process:
…Very young children lack knowledge of their own capabilities and the demands and potential hazards of different courses of action. They would repeatedly get themselves into dangerous predicaments were it not for the guidance of others. They can climb to high places, wander into rivers or deep pools, and wield sharp knives before they develop the necessary skills for managing such situations safely…Adult watchfulness and guidance see young children through this early formative period until they gain sufficient knowledge of what they can do and what different situations require in the way of skills. (pg. 414; Bandura, 1986)
During infancy, the development of perceived causal efficacy, in other words the perception that one has affected the world by one’s own actions, appears to be an important aspect of developing a sense of self. As the infant interacts with its environment, the infant is able to cause predictable events, such as the sound that accompanies shaking a rattle. The understanding that one’s own actions can influence the environment is something Bandura refers to as personal agency , the ability to act as an agent of change in one’s own world. The infant also begins to experience that certain events affect models differently than the child. For example, if a model touches a hot stove it does not hurt the infant, so the infant begins to recognize their uniqueness, their actual existence as an individual. During this period, interactions with the physical environment may be more important than social interactions, since the physical environment is more predictable, and therefore easier to learn about (Bandura, 1986, 1997). Quickly, however, social interaction becomes highly influential.
Not only does the child learn a great deal from the family, but as they grow peers become increasingly important. As the child’s world expands, peers bring with them a broadening of self-efficacy experiences. This can have both positive and negative consequences. Peers who are most experienced and competent can become important models of behavior. However, if a child perceives themselves as socially inefficacious, but does develop self-efficacy in coercive, aggressive behavior, then that child is likely to become a bully. In the midst of this effort to learn socially acceptable behavior, most children also begin attending school, where the primary focus is on the development of cognitive efficacy. For many children, unfortunately, the academic environment of school is a challenge. Children quickly learn to rank themselves (grades help, both good and bad), and children who do poorly can lose the sense of self-efficacy that is necessary for continued effort at school. According to Bandura, it is important that educational practices focus not only on the content they provide, but also on what they do to children’s beliefs about their abilities (Bandura, 1986, 1997).
As children continue through adolescence toward adulthood, they need to assume responsibility for themselves in all aspects of life. They must master many new skills, and a sense of confidence in working toward the future is dependent on a developing sense of self-efficacy supported by past experiences of mastery. In adulthood, a healthy and realistic sense of self-efficacy provides the motivation necessary to pursue success in one’s life. Poorly equipped adults, wracked with self-doubt, often find life stressful and depressing. Even psychologically healthy adults must eventually face the realities of aging, and the inevitable decline in physical status. There is little evidence, however, for significant declines in mental states until very advanced old age. In cultures that admire youth, there may well be a tendency for the aged to lose their sense of self-efficacy and begin an inexorable decline toward death. But in societies that promote self-growth throughout life, and who admire elders for their wisdom and experience, there is potential for aged individuals to continue living productive and self-fulfilling lives (Bandura, 1986, 1997).
discussion question \(\PageIndex{1}\)
Self-efficacy refers to our beliefs regarding our actual abilities, and self-esteem refers to how we feel about ourselves. What are you good at? Do others agree that you are good at that skill? When you find yourself trying to do something that you are NOT good at, does it disappoint you (i.e., lower your self-esteem)?
Behavior Modification
In Principles of Behavior Modification (Bandura, 1969), Bandura suggests that behavioral approaches to psychological change, whether in clinical settings or elsewhere, have a distinct advantage over many of the other theories that have arisen in psychology. Whereas psychological theories often arise first, become popular as approaches to psychotherapy, but then fail to withstand proper scientific validation, behavioral approaches have a long history of rigorous laboratory testing. Thus, behavioral techniques are often validated first, and then prove to be applicable in clinical settings. Indeed, behavioral and cognitive approaches to psychotherapy are typically well respected amongst psychotherapists (though some might consider their range somewhat limited).
Bandura made several points regarding the application of social learning theory to behaviorally-oriented psychotherapy. For example, Bandura notes that the labeling of psychological disorders, indeed the definition of what constitutes abnormal behavior, is made within a social context. While it has been demonstrated that common categories of mental illness are seen throughout a wide variety of cultures (Murphy, 1976), we still view those with psychological disorders based on sociocultural norms and, in the case of too many observers, with unreasonable prejudice. Bandura also opposed the medical model of categorizing and treating psychopathology, believing that the desire to identify and utilize medications has hindered the advancement of applying appropriate psychotherapies. The application of an appropriate therapy involves issues of ethical concern and goal-setting. Therapy cannot be successful, according to Bandura, if it does not have clear goals characterized in terms of observable behaviors. Choosing goals means that one must make value judgments. In making these decisions it is important that the client and the therapist share similar values (or at least that the therapist work with values appropriate for their client), and that the therapist does not try to impose their own values on the client (Bandura, 1969).
Overall, Bandura presents behavioral approaches to psychotherapy as non-judgmental applications of learning principles to problematic behavior, behavior that is not to be viewed as psychological “illness:”
…From a social-learning perspective, behaviors that may be detrimental to the individual or that depart widely from accepted social and ethical norms are considered not as manifestations of an underlying pathology but as ways, which the person has learned, of coping with environmental and self-imposed demands. (pg. 62; Bandura, 1969)


1.6: Quick Start
The goal of the LibreTexts project is to establish a vetted, comprehensive, and widely used platform for the dissemination and implementation of customized materials for post-secondary courses, while significantly reducing textbook costs for students. The LibreTexts project consists of 13 independently operating and interconnected “libraries” that focus on augmenting education in separate fields via a series of open-access online textbook environments that includes complementary ancillaries that advance diverse pedagogical methods and support multiple student learning styles.
Campus BookshelvesThe Course area holds campus- and faculty-specific courses. Each course shell is uniquely designed to address the needs of faculty and their students and typically contains text remixes (i.e., texts generated from existing content often with customized editing and/or content interspersed) that students and faculty can directly access for their class activities. |
BookshelvesBookshelves in a LibreTexts Library holds texts that are curated by the LibreTexts Development team and can be used either directly or to create customized remixes (i.e., texts generated from existing content often with editing and/or content interspersed) for use in campus Course Shells. |
editing works best with Google Chrome and Windows 10
LibreTexts can be read on any HTML5 device and any browser
How to Login
Enter the username and password you have been provided to log in. Credentials are specific to each library.
When you login the gray bar will turn black. Move the cursor to your userID on the far right hand side of the black bar and click on Sandbox to go to your Sandbox(es) (some people have more than one!)
Once you go to your Sandbox the black bar will have Edit, New and Options buttons. Two additional boxes, Training Tutorials and References and LibreFest have appeared. The LibreFest box is for a recent workshop. For now click on your Sandbox
|
LibreTexts libraries follow a specialized site structure that is optimized for users. Book/Units have Chapters and Chapters have Sections/Pages. For more complex structures see the complete online Construction Guide, but for this workshop we will stick with the simple one where you will create your own book under the guide that has been created for the workshop. Let's get started. Next click on New on the black bar |
| Because you are starting in a Book, only the Book and Chapter options are available. At this time you want to create your own book so select that and click on create or simply double click on the Book option. |
BEST JUST SAVE
Any references to templates and article type tags at the top of the page (such as
Creating a New Chapter
- On the black toolbar, click New .
-
Select the following page default classifications:
- Chapter
- Click the Create button.
The Editor will create a new chapter in your book.
Title Your Chapter
LibreTexts has a uniform title format that that should be used unless it is impossible. Each chapter should be formatted like XX: Title
- XX is the chapter number
- title is the page title
This approach preserves curation and remixing ability of the pages as well as automatic equations/figure/table numbering that work off of the title of the page.
- Title your Chapter as 1: First Chapter for now .
- You can add text in the box explaining the purpose of your book now or later.
- Click Save .
The system will now invite you to build out a guide. Guides are the way that you and other users navigate through the system. Click on the tab at the left hand side with a "+" on it to see the choices for the guides. Select Article Directory and then click on the "add new tab" button. This creates a new guide (with nothing in it).
Creating a New Page
|
You should see your first page of the chapter. You can continue editing by clicking Edit or create the next page.
Editing a Page
The Mindtouch platform LibreTexts uses has a modified CKE editor from CKSource that allows for construction without having to build/edit raw (HTML) code. The editor is WYSIWYG that automatically creates HTML from visual authoring. The editor displays when you create a new page or edit a page. It is designed to bring common word processor features directly to web pages, simplifying content creation.
- After saving the page on the MindTouch toolbar, select Edit .
- Edit the content as necessary. See a complete list of editor tools .
- In the Edit summary field at the bottom of the page, leave change notes for other editors or yourself (optional). Edit summaries can be viewed in the page revision history.
- Click Save to save the changes you made.
AUTOMATIC SAVING & WORD COUNTS
- Automatic saving - By default, the LibreTexts libraries autosave pages every 25 seconds in case your browser crashes or computer restarts so that you can return to the page and pick up where you left off.
- Word count - A word and character count is displayed in the upper right corner of the editor UI.
The Editor
The Editor has been configured for most of the needs contributors require. The layout is below; please refrain from using the advanced features in red until you are familiar with the Mindtouch structure. The Toolbar is the section located at the top of the editor window. It contains menu buttons that give you access to various functions of CKEditor. All buttons are grouped according to their function and include both simple operations (like basic text styling or formatting) and more advanced features (like inserting media or forms via a dialog window).
DO NO HARM (OR ILLEGAL Stuff)
You are responsible for content that you provide, including but not limited to photos, profiles information, messages, search results, edits, etc. that you upload, publish or display on or through LibreTexts, or transmit to or share with others. You may not submit content to LibreTexts that you did not create or that you do not have permission to submit. You understand and agree that others may, but are not obligated to, edit, delete or remove (without notice) any content from LibreTexts, for any reason or no reason.
Adding Figures the Easy Way - Drag and Drop
- "Save" or "export" the figures into jpg, png, gif or some other graphics file depending on the program you are using to make the image (JPG and PNG are preferred).
- Drag and drop the image from your desktop to your page (while editing).
Additional factors to pay attention to regarding figures
- NO BMP figures are allowed to be imported. Use PNG, JPG, or GIF figures instead.
- Please CROP your figures to remove superfluous white space that makes reading your module awkward. The Microsoft Office Picture Editor or Paint will crop images and is free on MS operating systems.
- All figures constructed for this project must have the original non-image files used uploaded to the LibreTexts, preferable in the module itself. DO NOT HOTLINK images.
Formatting Figures
|
Double click on image (in edit mode) to open settings and make sure settings are set right. To center justify figure, click on the right side of the image (not the figure) and you can use the center justification for text off the normal editing toolbar. |
Adding Captions
To add a caption add a line under the figure formatted as
Figure \(\PageIndex{i}\): Captiontext
where \( i \) is the number of the figure on the page. This automatically formats the caption into the caption style you see on the figures on this page. Unfortunately, if you add another figure that requires renumbering the figures after it, this still has to be done manually.
Figure captions Format
The figure label should be formatted as shown for the figure above:
- Center justified
-
"Figure" in bold followed by numbering with a page index command and a colon like this: Figure
\(\PageIndex{1}\):
- Manually enter the figure number in the \Pageindex command, "1" for the first figure of the page, "2" for the second, etc.
Alt-Text for Accessibility
Each Figure and Table has a simple option to add alt-texts. Just double right click on the image to get the figure setting and select image properties from the menu that appears and you can add alt-test into the entry. See section on Alt-texts for more details.
Hyperlinking
To ensure effective coupling of pages within the LibreTexts, content on pages can be "hyperlinked" to other pages. This is simple:
- Mark the word you want to be the hyperlink, then click the hyperlink button with the "chain link" icon.
- If you want to link to an outside page place the address in the “link to” box and click “update link”.
- If you want to link to an internal LibreTexts module you can use the “browse” option to find the page. You can also use the search function to look for key words (make sure you check that the page is a relevant link though).
Link Farming: DO NOT HYPERLINK OUTSIDE OF THE LIBRARY UNLESS NECESSARY
WHILE CURATING IS KEY TO THE LIBRETEXTS PLATFORM, LINK FARMING (NEEDING TO CURATE DEAD LINKS) IS TO BE AVOIDED.
Adding Templates
|
Under Elements of the editing toolbar, there is an option for "Templates". These are specialized code snippets that are designed for adding standard code to your page. Some of these templates are for general use and other are more specific. The six BOX templates add the text for a container around special text (see below). The Embed templates are for special HTML5 interactive code like Jupyer executable code or interactive molecules . The other templates will be discussed in a different section. Feel free to add any of them to a test page to see what it does. |
|
Definition A cow is an animal |
Example \(\PageIndex{1}\)
Add text here.
|
Exercise \(\PageIndex{1}\)
Add exercises text here
|
|
Note The ideal gas law is easy to remember and apply in solving problems |
Learning Objectives
|
Theorem \(\PageIndex{1}\)
Statement.
|
Remixing
The OER Remixer allows rapid assembly of customized Remixes from existing sources on our comprehensive and ever-growing libraries. See the Remixer Tutorial in Chapter 7 of the Construction Guide for a more detailed explanation of the Remixer's interface and a walkthrough of how to do basic tasks with the OER Remixer, as well as videos. Your Remixing Map is stored automatically on your computer as you build, so you do not have to complete your Remix in one setting. The Remixer works best on Chrome browsers running on W10.
Before using the OER Remixer , it is important to construct a Remixing Map. Lubbock Christian University created an excellent excel sheet to help out in this procedure. The gist of the map is to identify the content in the libraries (green) that will map into the organization of the new remix (yellow). This requires faculty/instructional designers to peruse the Bookshelves of Source texts and of other Course Remixes to identify desired content. Once remixed, these pages can be then edited at the sub-page level (e.g., sub-sections, paragraph, pages etc). The Remixing Map reflects only the initial organization of a custom remix. Notice the customized organization; there is no limit other than imagination and the size/makeup of the LibreTexts libraries. While the Remixing Map below does not demonstrate it, it is possible to make placeholder pages in the Remixer if a gap exists in the libraries. New custom content can be added to these pages once the text is created.


11.13: Introduction to Merchandise Planning and Management
What you’ll learn to do: Identify the important aspects of merchandise planning and management
Merchandise management and planning are an essential part of successful apparel retailers. Here are a few statistics to consider regarding the size of the apparel market on a global level.
In total the global apparel market is approximately $3 billion dollars, 2% of the world’s GDP (Gross Domestic Product. How does that break down into categories within the global apparel market?
- Womenswear: $621 billion
- Menswear: $402 billion
- Childrenswear: $186 billion
- Sports Footwear: $90 billion
- Bridalwear: $57 billion
- Luxury Goods: $339 billion
In this module we will explore the important characteristics of Merchandise Management that support this $3B industry.
Contributors and Attributions
CC licensed content, Original
- Introduction to Merchandise Planning and Management. Authored by : Robert Danielson. Provided by : Lumen Learning. License : CC BY: Attribution


11.3: Digestive System
There are four steps in the digestive process. The first step is ingestion, the intake of food into the digestive tract. Ingestion may seem a simple process, but it includes smelling food as it is prepared and served, thinking about food and making food choices, and the involuntary release of saliva in the mouth to prepare for food entry. After food enters the mouth, the next steps of mechanical and chemical digestion of food begin. Mechanical digestion starts with chewing when teeth crush and grind large food particles into smaller pieces that are easy to swallow. Chemical digestion of food involves enzymes found in saliva that break down particles into smaller components. [1]
In the mouth, saliva provides lubrication and enables food to move downward through the esophagus (a muscular tube that goes from the mouth to the stomach). This slippery mass of partially broken-down food is called a bolus that moves down the digestive tract after it is swallowed. Swallowing is initially voluntary because it requires conscious effort to push the food with the tongue back towards the throat, but then it proceeds involuntarily through the gastrointestinal tract, meaning it proceeds without conscious control.
As the bolus is swallowed, it is pushed from the mouth through the pharynx (i.e., throat) and into the esophagus. As the bolus travels through the pharynx, a small flap called the epiglottis closes to keep food from going into the trachea and down into the lungs. Peristaltic contractions in the esophagus (referred to as peristalsis ) propel the bolus down to the stomach. At the junction between the esophagus and stomach, there is a sphincter that remains closed until the food bolus approaches. The pressure of the food bolus stimulates the lower esophageal sphincter to relax and open, causing the food to move from the esophagus into the stomach. The mechanical digestion of food continues by the muscular contractions of the stomach and small intestine that mash, mix, and continue to propel the bolus down the digestive tract. [2]
In the small intestine , nutrients are absorbed from the bolus and then transported throughout the body by the cardiovascular system. The small intestine is typically 25 to 30 feet in length with a smaller diameter than the large intestine. After passing through the small intestine, the bolus enters the large intestine. The large intestine is about 8 to 10 feet in length with a larger diameter than the small intestine. Water is absorbed from the bolus in the large intestine, making it solid and formed. It eventually reaches the anus and is expelled as feces. [3] See Figure 11.3 [4] for an illustration of digestion.
View the following Khan Academy video for an overview of the digestive process [5] : The Digestive System.
As people age, many age-related changes occur in the digestive system. The condition of one’s teeth (referred to as dentition ) often declines during the aging process, resulting in the decreased ability to chew foods with a dense or tough consistency (such as meat and fibrous vegetables). Production of saliva also decreases, increasing the risk for choking. Additionally, many medications cause a side effect of dry mouth that further contributes to the risk of choking. The epiglottis may weaken and allow food or fluids to enter the lungs that can cause aspiration pneumonia. Absorption of nutrients in the small intestine is less efficient, which can cause malnutrition even though food intake may be sufficient. Lastly, the slowing of peristalsis allows the bolus to remain in the large intestine for longer periods of time. As water continues to be absorbed, the fecal matter becomes drier and more difficult to expel, resulting in constipation and possible bowel obstruction.
A bowel obstruction stops the bolus and other digestive contents from reaching the part of the intestine beyond the blockage. The lack of peristalsis that occurs during a bowel obstruction can cause the large intestine to twist upon itself, cutting off circulation and causing tissue death. The area of the intestine experiencing tissue death may require surgical removal. Sometimes the remaining parts of the healthy intestine can be reattached to regain normal bowel function. However, if reattachment is not possible, an opening (called a stoma ) is surgically created in the abdominal wall where the healthy part of the intestine is attached. (This type of surgery to create a stoma in the colon is referred to as a colostomy .) Fecal matter is collected in a drainage bag that attaches to the stoma via a device commonly called a wafer. In this manner, elimination occurs through the stoma into a pouch rather than through the rectum. Bowel obstructions, as well as other gastrointestinal conditions such as colon cancer, severe infection, fistulas, or colon injuries, can lead to the placement of a stoma. See Figure 11.4 for an image of a stoma, Figure 11.5 [6] for an image of the wafer to which the drainage bag attaches, and Figure 11.6 [7] for an image of an atta ched drainage bag.
The most effective interventions for improving digestive function are to encourage intake of fiber, water, and other fluids, as well as promoting activity as tolerated. Fiber adds bulk to the bolus to keep it moving through the large intestine. Fiber is found in plants, so any food that originates from growing in the ground contains fiber. Examples of high-fiber foods include grains in bread and cereal, rice, barley, quinoa, fruits, and vegetables. Whole grains are preferred because they contain more fiber than processed grains. Water and other fluids aid in peristaltic movement, and activity increases circulation to improve digestive function. See Table 11.3 for common digestive system diagnoses, associated symptoms to report to the nurse, and specific interventions the nursing assistant can implement to promote digestive function. Refer to section Chapter 5.7, “ Assisting With Nutrition and Fluid Needs ” for additional review of digestive interventions.
Table 11.3 Common Digestive System Diagnoses and Specific Nursing Assistant Interventions [8] , [9] , [10] , [11] , [12]
| Diagnosis | Definition | Symptoms to Report | Nursing Assistant Interventions |
|---|---|---|---|
| Hemorrhoids | Swollen vein(s) in the rectum and anus caused by straining from constipation, during childbirth, or from regular heavy lifting. Risk increases with aging. |
Bleeding during bowel movements should be reported to the nurse for follow-up.
If a hemorrhoid becomes strangulated or a clot forms in a hemorrhoid, it can cause severe pain, swelling, inflammation, or a hard lump near the anus and should be immediately reported. |
|
| Irritable Bowel Syndrome (IBS) | A chronic disorder causing cramping, abdominal pain, bloating, gas, diarrhea, and constipation. Symptoms may be triggered by stress or specific foods. | Increased symptoms. |
|
| Gastroesophageal Reflux Disease (GERD) | Stomach acid flows back into the esophagus, causing symptoms often referred to as “heartburn.” | Burning sensation in chest, regurgitation of food or sour liquid, or chronic cough. |
|
| Food Intolerance | An inability to digest specific foods. Common food intolerances are lactose intolerance (dairy) or gluten intolerance (wheat). | Increased gas, bloating, diarrhea, and abdominal cramping. |
|
| Food Allergies | An immune system reaction to a specific food that can range from mild to life-threatening. | Immediately report hives (a new rash); swelling of the lips, tongue, or throat; or problems breathing. |
|
- This work is a derivative of Human Nutrition by University of Hawai‘i at Mānoa Food Science and Human Nutrition Program and is licensed under CC BY NC SA 4.0 ↵
- This work is a derivative of Human Nutrition by University of Hawai‘i at Mānoa Food Science and Human Nutrition Program and is licensed under CC BY NC SA 4.0 ↵
- This work is a derivative of Human Nutrition by University of Hawai‘i at Mānoa Food Science and Human Nutrition Program and is licensed under CC BY NC SA 4.0 ↵
- “Digestive-system-overview.jpg” by Allison Calabrese is licensed under CC BY 4.0 . Access for free at https://pressbooks.oer.hawaii.edu/humannutrition/chapter/the-digestive-system-2/ ↵
- Khan Academy. (n.d.). The digestive system [Video]. Khan Academy. All rights reserved. https://www.khanacademy.org/science/biology/crash-course-bio-ecology/crash-course-biology-science/v/crash-course-biology-127 ↵
- “ Ostomy_wafer_being_worn_by_an_ileostomy_patient.jpg ” by Eric Polsinelli (VeganOstomy) is licensed under CC BY 4.0 ↵
- “ Ileostomy_2016-09-09_4158.jpg ” by Salicyna is licensed under CC BY-SA 4.0 ↵
- Mayo Clinic Staff. (2021, May 12). Hemorrhoids. https://www.mayoclinic.org/diseases-conditions/hemorrhoids/symptoms-causes/syc-20360268 ↵
- Mayo Clinic Staff. (2021, December 1). Irritable bowel syndrome. https://www.mayoclinic.org/diseases-conditions/irritable-bowel-syndrome/symptoms-causes/syc-20360016 ↵
- Mayo Clinic Staff. (2020, May 22). Gastroesophageal reflux disease (GERD ). https://www.mayoclinic.org/diseases-conditions/gerd/symptoms-causes/syc-20361940 ↵
- Mayo Clinic Staff. (2022, March 5). Lactose intolerance. https://www.mayoclinic.org/diseases-conditions/lactose-intolerance/symptoms-causes/syc-20374232 ↵
- Mayo Clinic Staff. (2022, June 16). Milk allergy. https://www.mayoclinic.org/diseases-conditions/milk-allergy/symptoms-causes/syc-20375101 ↵


2.14: Navigating the File System
-
- Last updated
- Save as PDF
In this section I talk a little about how R interacts with the file system on your computer. It’s not a terribly interesting topic, but it’s useful. As background to this discussion, I’ll talk a bit about how file system locations work in Section 4.4.1. Once upon a time everyone who used computers could safely be assumed to understand how the file system worked, because it was impossible to successfully use a computer if you didn’t! However, modern operating systems are much more “user friendly”, and as a consequence of this they go to great lengths to hide the file system from users. So these days it’s not at all uncommon for people to have used computers most of their life and not be familiar with the way that computers organise files. If you already know this stuff, skip straight to Section 4.4.2. Otherwise, read on. I’ll try to give a brief introduction that will be useful for those of you who have never been forced to learn how to navigate around a computer using a DOS or UNIX shell.
file system itself
In this section I describe the basic idea behind file locations and file paths. Regardless of whether you’re using Window, Mac OS or Linux, every file on the computer is assigned a (fairly) human readable address, and every address has the same basic structure: it describes a path that starts from a root location , through as series of folders (or if you’re an old-school computer user, directories ), and finally ends up at the file.
On a Windows computer the root is the physical drive
50
on which the file is stored, and for most home computers the name of the hard drive that stores all your files is C: and therefore most file names on Windows begin with C:. After that comes the folders, and on Windows the folder names are separated by a
\
symbol. So, the complete path to this book on my Windows computer might be something like this:
C:\Users\danRbook\LSR.pdf
and what that
means
is that the book is called LSR.pdf, and it’s in a folder called
book
which itself is in a folder called dan which itself is … well, you get the idea. On Linux, Unix and Mac OS systems, the addresses look a little different, but they’re more or less identical in spirit. Instead of using the backslash, folders are separated using a forward slash, and unlike Windows, they don’t treat the physical drive as being the root of the file system. So, the path to this book on my Mac might be something like this:
/Users/dan/Rbook/LSR.pdf
So that’s what we mean by the “path” to a file. The next concept to grasp is the idea of a
working directory
and how to change it. For those of you who have used command line interfaces previously, this should be obvious already. But if not, here’s what I mean. The working directory is just “whatever folder I’m currently looking at”. Suppose that I’m currently looking for files in Explorer (if you’re using Windows) or using Finder (on a Mac). The folder I currently have open is my user directory (i.e.,
C:\Users\dan
or
/Users/dan
). That’s my current working directory.
The fact that we can imagine that the program is “in” a particular directory means that we can talk about moving
from
our current location
to
a new one. What that means is that we might want to specify a new location in relation to our current location. To do so, we need to introduce two new conventions. Regardless of what operating system you’re using, we use . to refer to the current working directory, and .. to refer to the directory above it. This allows us to specify a path to a new location in relation to our current location, as the following examples illustrate. Let’s assume that I’m using my Windows computer, and my working directory is
C:\Users\danRbook
). The table below shows several addresses in relation to my current one:
Table 4.1: Basic arithmetic operations in R. These five operators are used very frequently throughout the text, so it’s important to be familiar with them at the outset.
| absolute path (i.e., from root) | relative path (i.e. from C:) |
| C:\Users\dan | .. |
| C:\Users | ..\.. \ |
| C:\Users\danRbook\source | .\source |
| C:\Users\dan\nerdstuff | ..\nerdstuff |
There’s one last thing I want to call attention to: the
~
directory. I normally wouldn’t bother, but R makes reference to this concept sometimes. It’s quite common on computers that have multiple users to define
~
to be the user’s home directory. On my Mac, for instance, the home directory
~
for the “dan” user is
\Users\dan\
. And so, not surprisingly, it is possible to define other directories in terms of their relationship to the home directory. For example, an alternative way to describe the location of the
LSR.pdf
file on my Mac would be
~Rbook\LSR.pdf
That’s about all you really need to know about file paths. And since this section already feels too long, it’s time to look at how to navigate the file system in R.
Navigating the file system using the R console
In this section I’ll talk about how to navigate this file system from within R itself. It’s not particularly user friendly, and so you’ll probably be happy to know that Rstudio provides you with an easier method, and I will describe it in Section 4.4.4. So in practice, you won’t really need to use the commands that I babble on about in this section, but I do think it helps to see them in operation at least once before forgetting about them forever.
Okay, let’s get started. When you want to load or save a file in R it’s important to know what the working directory is. You can find out by using the
getwd()
command. For the moment, let’s assume that I’m using Mac OS or Linux, since there’s some subtleties to Windows. Here’s what happens:
getwd()
## [1] "/Users/dan"
We can change the working directory quite easily using
setwd()
. The
setwd()
function has only the one argument,
dir
, is a character string specifying a path to a directory, or a path relative to the working directory. Since I’m currently located at
/Users/dan
, the following two are equivalent:
setwd("/Users/dan/Rbook/data")
setwd("./Rbook/data")
Now that we’re here, we can type
list.files()
command to get a listing of all the files in that directory. Since this is the directory in which I store all of the data files that we’ll use in this book, here’s what we get as the result:
list.files()
## [1] "afl24.Rdata" "aflsmall.Rdata" "aflsmall2.Rdata"
## [4] "agpp.Rdata" "all.zip" "annoying.Rdata"
## [7] "anscombesquartet.Rdata" "awesome.Rdata" "awesome2.Rdata"
## [10] "booksales.csv" "booksales.Rdata" "booksales2.csv"
## [13] "cakes.Rdata" "cards.Rdata" "chapek9.Rdata"
## [16] "chico.Rdata" "clinicaltrial_old.Rdata" "clinicaltrial.Rdata"
## [19] "coffee.Rdata" "drugs.wmc.rt.Rdata" "dwr_all.Rdata"
## [22] "effort.Rdata" "happy.Rdata" "harpo.Rdata"
## [25] "harpo2.Rdata" "likert.Rdata" "nightgarden.Rdata"
## [28] "nightgarden2.Rdata" "parenthood.Rdata" "parenthood2.Rdata"
## [31] "randomness.Rdata" "repeated.Rdata" "rtfm.Rdata"
## [34] "salem.Rdata" "zeppo.Rdata"
Not terribly exciting, I’ll admit, but it’s useful to know about. In any case, there’s only one more thing I want to make a note of, which is that R also makes use of the home directory. You can find out what it is by using the
path.expand()
function, like this:
path.expand("~")
## [1] "/Users/dan"
You can change the user directory if you want, but we’re not going to make use of it very much so there’s no reason to. The only reason I’m even bothering to mention it at all is that when you use Rstudio to open a file, you’ll see output on screen that defines the path to the file relative to the #~# directory. I’d prefer you not to be confused when you see it. 51
the Windows paths use the wrong slash?
Let’s suppose I’m on Windows. As before, I can find out what my current working directory is like this:
getwd()
## [1] "C:/Users/dan/
This seems about right, but you might be wondering why R is displaying a Windows path using the wrong type of slash. The answer is slightly complicated, and has to do with the fact that R treats the
\
character as “special” (see Section 7.8.7). If you’re deeply wedded to the idea of specifying a path using the Windows style slashes, then what you need to do is to type
/
whenever you mean
\
. In other words, if you want to specify the working directory on a Windows computer, you need to use one of the following commands:
setwd( "C:/Users/dan" )
setwd( "C:\\Users\\dan" )
It’s kind of annoying to have to do it this way, but as you’ll see later on in Section 7.8.7 it’s a necessary evil. Fortunately, as we’ll see in the next section, Rstudio provides a much simpler way of changing directories…
Navigating the file system using the Rstudio file panel
Although I think it’s important to understand how all this command line stuff works, in many (maybe even most) situations there’s an easier way. For our purposes, the easiest way to navigate the file system is to make use of Rstudio’s built in tools. The “file” panel – the lower right hand area in Figure 4.7 – is actually a pretty decent file browser. Not only can you just point and click on the names to move around the file system, you can also use it to set the working directory, and even load files.
Here’s what you need to do to change the working directory using the file panel. Let’s say I’m looking at the actual screen shown in Figure 4.7. At the top of the file panel you see some text that says “Home > Rbook > data”. What that means is that it’s displaying the files that are stored in the
/Users/dan/Rbook/data
directory on my computer. It does not mean that this is the R working directory. If you want to change the R working directory, using the file panel, you need to click on the button that reads “More”. This will bring up a little menu, and one of the options will be “Set as Working Directory”. If you select that option, then R really will change the working directory. You can tell that it has done so because this command appears in the console:
setwd("~/Rbook/data")
In other words, Rstudio sends a command to the R console, exactly as if you’d typed it yourself. The file panel can be used to do other things too. If you want to move “up” to the parent folder (e.g., from
/Users/dan/Rbook/data
to
/Users/dan/Rbook
click on the “..” link in the file panel. To move to a subfolder, click on the name of the folder that you want to open. You can open some types of file by clicking on them. You can delete files from your computer using the “delete” button, rename them with the “rename” button, and so on.
As you can tell, the file panel is a very handy little tool for navigating the file system. But it can do more than just navigate. As we’ll see later, it can be used to open files. And if you look at the buttons and menu options that it presents, you can even use it to rename, delete, copy or move files, and create new folders. However, since most of that functionality isn’t critical to the basic goals of this book, I’ll let you discover those on your own.