You're watching FJTN, the Federal Judicial Television Network. And welcome again to Perspectives. In this third edition of the FJC's TV magazine program for federal probation and pretrial services offices, we'll report on an innovative procedure for expediting pre-sentence investigations developed in the Southern District of New York. We'll also tell you about new center research on possible case management tools based on the risk prediction index to help pretrial services officers with supervision duties. And we'll hear from the Sentencing Commission, as well as get a legal update from David Adair, AO Associate General Counsel. But this program will focus mainly on the National Sentencing Policy Institute that was held in March in Long Beach, California. The stories will give you a rare glimpse of how policy and practice can influence each other as a result of dialogue among Institute participants. The Judicial Conference's Criminal Law Committee was instrumental in planning the meeting, working in conjunction with the FJC, which conducted the Institute under the committee's auspices. The committee is charged with representing the judiciary on criminal law legislation, sentencing issues, and guidelines. Representatives of the Administrative Office, the Sentencing Commission, and the Federal Bureau of Prisons also joined in planning sessions over the past year. Like its predecessor Institute held in January 1997, the March Conference departed from earlier circuit-based institutes that concentrated on practice and guidelines interpretation. It offered instead a unique forum for discussion of national sentencing policy issues. More than 150 participants from every circuit, including key officials from the executive, legislative, and judicial branches, took advantage of this rare opportunity to consider the issues together. They included federal district and appellate court judges, U.S. attorneys, federal defenders, federal probation officers, and staff from the Administrative Office, the U.S. Sentencing Commission, and the Federal Bureau of Prisons. Chief, deputy, and line probation officers attended. In opening the meeting, Chief District Judge George Cazan, Chair of the Criminal Law Committee emphasized that in addition to the goal of providing the committee and the Sentencing Commission with input about sentencing policy, the Institute had another important objective. The other force is to increase and enhance dialogue between judges and other major components of the system. So as we go along in this week, you judges will have an opportunity to dialogue with probation officers, prison officials, U.S. attorneys, and so forth, public defenders, to better inform each other about the roles that we play in the sentencing process. With the implementation of the Sentencing Guidelines in 1987, probation officers have come to play an increasingly important role in the sentencing process. And closely with U.S. attorneys, federal defenders, private defense counsel, and district and magistrate judges, they find their work subject to wider scrutiny and greater accountability than ever before. For that reason, it's vital that officers have up-to-date information and a grasp of underlying sentencing issues and policy decisions. That's why we're televising for you some of the discussions and events that took place at the Sentencing Policy Institute. The role of Congress in setting sentencing policy and recent legislative developments, the latest views on judicial discretion and departures in light of the Supreme Court's Kuhn decision, unresolved circuit conflicts and guideline application, and current Bureau of Prisons Programs and Operations. In a first for a sentencing institute, three staff members of the House and Senate Judiciary Committees, which oversee judicial branch operations, provided insight into recent congressional actions involving sentencing issues. District Judge Richard Arquera set the context for the discussion. He recounted how, in the 1980s, Congress abandoned its historically limited role in sentencing, which had allowed judges total discretion to impose sentences up to a maximum established by law. Citing excessive disparity and inconsistency in criminal sentences, Congress reevaluated the entire federal sentencing system and in 1984 enacted the Sentencing Reform Act. However, Judge Arquera said, Congress's pursuit of enhanced effectiveness in sentencing did not end there. Beginning in 1984, Congress enacted an array of mandatory minimum penalties, specifically intended to attack drug offenses and violent crimes. In 1990, Congress formally directed the sentencing commission to study the effectiveness of mandatory minimum sentences. In 1991, the commission issued a report, finding that despite the expectation that mandatory minimums would be applied in all relevant cases, inconsistent application by prosecutors was creating substantial disparity in sentencing. In recent years, Congress appears to be more opting to more and more for a specific directive method of implementing sentencing policy. That is, directing the sentencing commission to implement specific changes in offense levels and guideline ranges. The use of these specific directives by Congress to tinker with the specific guidelines levels causes concern of the criminal law committee that by using specific directives, Congress is not necessarily taking into account how these specific changes, even though they may appear to be minor, may affect the overall coordination and implementation of the guidelines and the sentencing policy in general. Senate Judiciary Committee Minority General Counsel, Beryl Howell, explained that the effort to avoid adopting new mandatory minimums often results in congressional directives to the commission. I haven't sort of counted percentage times this has happened, but oftentimes when you see a final directive of some kind to the sentencing commission, I would say at least 50% of those times, it often starts off with a proposal for a new mandatory minimum. Michael Kennedy, Council on the Senate Judiciary Committee, reflected on the interplay between the branches in the enactment of sentencing legislation. Congress will pass a law, and the President will sign it, and then we'll see this interplay. The courts will go out and try to figure out, well, what did Congress mean? What did Congress intend to do? We'll see a number of court decisions, and then Congress will step back in and say, well, no, this isn't what we meant. Or right on, we really like what you're doing. I think that ideally, the sentencing guidelines will utilize all branches of the government to calibrate the sentences in a way that allows for individualized justice, but at the same time are consistent across the country. Kennedy noted two types of cases that contributed significantly to the growing number of criminal cases and defendants shown in 1997 statistics. The increases in the number of cases and defendants, I think, can be attributed to two chaotic cases that you all are very familiar with. Drug cases, which increased 12.9%, and INS or immigration cases, which increased a fairly amazing 20.8%. Brian Wolffolk, House Judiciary Committee Minority Council spoke of the impact that television has in the development of sentencing legislation. We're dealing in a time in which there are a lot of sound by politics. I mean, the three strikes you're out, I think it probably started with a sound bite, and then people figure out how we go about implementing it. Responding to a question from Judge Arquera, Wolffolk stressed that reason and logic can prevail over mandatory penalties. School boards have passed a lot of laws around the country that really don't make any sense when they kick people out for bringing a butter knife to school for their lunch box. When you think about the implications and impact, then people start slowing down by saying, we need some common sense in this. Howl added that the cost of imprisoning more inmates for longer periods of time is also causing second thoughts, especially in light of the Justice Department budget proposal this year. And that budget proposal contains almost a billion dollars in budget requests for three new federal prisons, as well as expansions of federal prisons. I think that there are members who are looking at the price tags for this and are getting more concerned about the cost of more mandatory minimums. So that when they're looking at broader societal impact, they're saying, do we want to spend another billion on more federal prisons? Or do we want to spend it on some other education program? And so I think that Congress is also quite able to make that broad policy assessment as well, and that there are many members who are making that assessment from both sides of the aisle. The growth of the federal prison population was a subject addressed by Kathleen Hawke Sawyer, director of the Federal Bureau of Prisons, in a presentation on current BOP operations and activities. In introducing her, Judge Stephen Wilson cited statistics that reveal the magnitude of the problem. As a nation, we have a prison population which is unprecedented. The New York Times of last Sunday had an article that reported that one out of every 150 Americans is now incarcerated. According to the article, 60% of the prisoners are incarcerated for drug-related crimes. The annual cost of housing a prisoner is set to be $20,000. Director Hawke Sawyer sketched out the current situation and the projections for future growth. Our current population, the Bureau of Prisons, is now 126,000 inmates, which is incredible. Our current projections, and these are very conservative projections in terms of what our numbers look like in the out years, but it suggests that our population is going to reach at least 150,000 by the year 2001 and at least 178,000 inmates by 2006. She said federal prisoners doubled in the last decade, and the numbers continue to break records. Last year, we experienced our largest growth year in the history of the Bureau of Prisons, which surprised the heck out of me, because I thought our biggest growth years were a few years ago. We grew by over 10,000 inmates. Hawke Sawyer attributed this to increased INS cases, methamphetamine prosecutions, and more FBI and DEA agents on the job. She noted that the dramatic increase began in the mid-'80s because of new sentencing legislation. Most of our growth since the mid-'80s is the result of the significantly long sentences with mandatory minimums in legislation enacted in 84, 86, 88, and 90, which created the determined sentencing, abolished parole, and reduced good time. All of that has meant that the increased investigations and prosecutions mean we get more inmates, and once we get them, we keep them for a long, long, long, long time. The explosion in numbers has put a strain on the federal prison system. We are now up to 94 institutions that are fully operational. That still leaves us 28% over capacity. Again, that is misleading. Our high security, our penitentiaries, are 46% over capacity right now. Our mediums are 49% over capacity. So we're desperately trying to get more facilities built at those security levels. On top of the 94 that are open, we have 18 more that are already funded by Congress and are going to be opening within now in the next about four years. In the face of the burgeoning population, Hawke Sawyer stressed that the Bureau is expanding its comprehensive sanction centers beyond the 40 currently in operation. Our comprehensive sanction centers have different layers or different tiers of security around them and how much freedom of movement or non-freedom of movement these inmates have. And we get wonderful cooperation from the United States probation staff because they hook up with these cases much earlier than normally, and they begin to work the case early on and it just gives you the sentencing judges more option in terms of what to do with supervised release violations. We'll be opening up more of those. In a break from panel discussions, Institute participants were given a tour of the nearby federal prison at Terminal Island. Their visit underscored the human impact of sentencing. Terminal Island is a medium security prison with about 1,000 inmates. In operation for 60 years, it's the oldest facility in the Western region. Prior to leaving for the ride to the prison, Warden Dick Clark set the stage for the afternoon tour. If you could stay together as a group, that would be helpful. However, if you see an inmate that you wish to talk to, let my staff know and they will accommodate your wish. Many officers feel that having this experience helps them do a better job. Assistant Deputy Chief Nancy Reems is one of them. I think we're more effective if we really have as good of an understanding as possible of what that experience has been for them. I'm here with the Bureau, so nice to meet you. Because in spite of the guidelines, it's still human beings that are being sentenced and who are going through this experience. So to see what their life is like in prison and to hear them speak about it themselves, I think, is information that's good for all of us to have. New Jersey District Judge Mary Ann Trump-Barry agrees. I love to go to prisons. I know that sounds rather perverse. But we spend so much time with our probation officers going through the computations and the permutations of the guidelines that it's nice to see the product of what we have done. And when we say two point enhancement, four point enhancement, upward, downward, we're dealing with lives. Something we don't remember enough. I think it's really important that probation officers, judges, prosecutors, and defense attorneys all make these trips just to remind us of what it is we do. The visit emphasized the human impact of sentencing to District Judges Joe Billy McDade and Juan Perez Jimenez. To me, it was very important to sit down with four inmates as we sat down and to hear the stories, to see how it was that they got into problems. And to listen to the experiences that I had with this system, I was very impressed with the sincerity of the inmates when they stated how was it that they came into the system and what sentence they got. I saw the end result of what I do when I sentence people. That's always dramatic and impressive. And it reinforces my desire to get it done right. It reminded me of the need we have to do a better job with the guidelines of trying to fit a sentence to the defendant. And this reflects the need we have to work closer with our probation people. Judge Perez Jimenez agreed that probation officers' input and advice on departures and other guidelines issues can help judges make better sentencing decisions. The judges depend on probation officers to bring the complete picture of that individual that we are gonna have before us for sentencing. I would then recommend to probation officers that they be as thorough as possible. That's their main concern or should be their main task in this. And then be frank with the judge. In exercising their responsibility, judges can gain significant benefit from prison tours, Judge Perez Jimenez said. I think the judges, whenever they have an opportunity to visit institutions that they do so. So as Judge McDade said, we see the final results of our job as sentences. As the judges and officers interviewed in the previous story emphasized, seeing and talking with prison inmates can serve as a vivid reminder of what's at stake in sentencing. Panelists in a discussion on judicial discretion and departures explored the importance of departures and arriving at just sentences. Judge McDade elaborated on his view of the probation officer's role in determining departures that will hold up on appeal. As judges Gerald E. Rosen and Joe Billing McDade acknowledged, tension between conflicting goals and sentencing is nothing new. The whole notion of attempting to achieve uniformity and proportionality on the one hand in sentencing with looking at the individual on the other hand and attempting to impose a sentence that is consistent with individual characteristics has been around since biblical times. It occurred to me, and we do this every day. We incorporate both of these concepts of justice in our everyday approach. Think of your children. To me, the rub is, the system ought to have a good balance and mix where one could easily incorporate these two concepts, which are not mutually exclusive, into our legal culture. What is relatively new is an increased interest on the part of some district judges triggered by the 1996 Supreme Court decision in Coon v. United States in using departures to achieve that balance. In Coon, the court held that appellate court review of a departure decision should be limited to the question of whether the sentencing court abused its discretion. The court noted that before departure is authorized, certain aspects of the case must be found unusual enough for it to fall outside the heartland of cases. The court also noted that the guidelines manual provides considerable guidance by recognizing certain factors as encouraged, discouraged, or forbidden. Now, in light of nearly three years of appellate decisions following Coon, panelists discussed the ways in which that case changed the legal landscape. Now, I believe the real import of Coon has been a psychological effect upon district judges. No one really taught us about departures. And we got all these opinions down from the circuit court, and I'm in the seventh circuit, that made you say, hey, I can't depart. And I think Coon sought to change that mindset. The Coon decision also provided district judges with guidance about how to depart. If Coon does anything, in addition to saying that we, as district judges, get more discretion and that the circuit judges at least should be more deferential to some of our discretionary calls on these issues, if Coon does anything, it does give us a framework to work within. And I think that that is something that is helpful. The framework suggested in Coon and refined in court of appeals decisions is depicted in a departure roadmap created by the commission. You look at the type of factor that we're talking about. So here we're talking about ever in conduct. And you ask yourself, is this the kind of a factor that may take the case out of the heartland of the cases? Then you get to whether it is encouraged in the guidelines, whether it is discouraged, whether it is unaddressed. If it's encouraged, you look at two questions. This roadmap illustrates the standard for when a departure is or is not an abuse of discretion. Judge McDade said team members other than judges should play an active role in crafting departures that meet the standard. We aren't getting as much help as we should from our probation people, and certainly not from the defendant, in suggesting to us bases for departure. They aren't giving us a rationale that we need in terms of the structure of the guidelines. The lawyers make the argument, and basically, they are arguing the general purposes of sentencing. Well, I know that, hey, that's not going to cut it. I can agree with you 100%. But unless I tailor my departure to the guidelines, I'm going to get reversed. Judge McDade urged other sentencing judges to seek help from probation officers, as he does himself. I've read that precinct's report. And if there's something that strikes me, that this seems a little bit unusual here, maybe there should be some departure. I was sent to the probation officer. Did you consider a departure on this basis? And we might talk about it. And I might say, look, well, look, go back and really work at this hard, because I'm not satisfied. And I think we should do that more often to encourage our probation people that they have a responsibility to us, to assist us in applying the departure guidelines. After that discussion, our perspectives producer asked Circuit Judge William W. Wilkins, Jr., former chair of the Sentencing Commission, for his thoughts about what Coon and its progeny mean for probation officers. The Coon allows more departures, at least the availability of more departures, either way. And the probation officer being the eyes and ears of the court is going to be that person to whom the district judges will look for recommendations. I think it's incumbent upon all probation officers to become very familiar with the Coon decision and its application. You can find the departure roadmap on the Sentencing Commission's web page at the address now on your screen. Departures as well as enhancements and other issues involving specific guidelines were taken up by a panel that addressed circuit conflicts. After guidelines are adopted by the Sentencing Commission and approved by Congress, their application is subject to interpretation by the courts. And appellate opinions in different circuits may take opposing views about some guidelines. Institute participants had the opportunity to learn more about conflicts involving eight separate guidelines issues, including downward departures for aberrant behavior, how to count harvested marijuana plants under the drug trafficking guideline, downward departures for substantial assistance, and upward departures based on dismissed or uncharged conduct. For each issue, two judges first presented the opposing arguments. Then, participants were asked to provide input on how the Sentencing Commission should resolve these conflicts. We'll give you a glimpse of how the process worked on one of the issues. Judge Wilkins, a member of the Criminal Law Committee, described how the results of participants' votes might be used. Your votes will be tabulated. And given to the commission, when the new commissioners are finally appointed for their use, is they will, in reality, begin to address these same issues. Judge Wilkins explained that in the 1991 decision, United States v. Braxton, the Supreme Court strongly affirmed the role of the commission in resolving inter-circuit conflicts. The Braxton opinion observed that under the Sentencing Reform Act, the Sentencing Commission has the initial and the primary task of addressing inter-circuit conflicts and guideline interpretation. Without periodic action by the commission resolving inter-circuit conflicts, the stated goal of the Sentencing Reform Act and a national uniform sentencing system cannot be achieved. Regarding whether a court can base an upward departure on dismissed or uncharged conduct, appellate Judge William Traxler spelled out the reasoning of three circuits that have ruled against it. It's just fundamentally unfair to tell a defendant, we're going to dismiss some charges against you if you'll plead guilty to others. And he does that. And then you turn around and say, but we're going to enhance your sentence based on the ones you didn't have to plead to. And these courts say that it will undermine plea bargaining first to tell a person and let a court use discharged or dismissed charges against a person. Also, it gives a prosecutor a chance, they would say, to punish a defendant when they may not have the proof to do so. District Judge William Osteen discussed the decisions of six circuits holding that a court may consider dismissed or uncharged conduct that has some relation to the crime of conviction. So this line of courts has said, in those situations, you have a right as a sentencing court to consider unusual events that occur that are not really allied with the crime that the person is pleading guilty to, so long as there is reliable information on which to base it. And the distinction that's made here is whether or not it relates to the same type of offenses. Judge Wilkins asked Sentencing Commission General Counsel John Steer whether decisions allowing upward departures based on uncharged conduct would violate the commission's policy on acceptance of plea agreements. Well, that's what has been argued by those who have interpreted the policy statements in Chapter 6 of the manual and other provisions, like 1B1.4, to disallow that kind of an upward departure. I think that while there are words there that you can put together to make out that kind of an argument, it's probably a little much to read all of that into what the commission wrote in Chapter 6. Before the vote on the issue, Judge Kason clarified participants' choices. We didn't try to cut it fine enough to distinguish between allow and encourage or prohibit and discourage, but just take it as a chunk like that, allow or encourage on the one hand versus prohibit or discourage on the other hand. In recommending commission action, participants agreed with the minority view of the seventh, eighth, and ninth circuits. By the widest margin of the vote on any issue, 78 to 49, they decided that the commission should prohibit or discourage upward departure based on dismissed or uncharged conduct. Some probation officers found the discussion of circuit conflicts enhanced their understanding of the guidelines as Chief Probation Officer Ray Frank observed. You don't often hear the opinions of other circuits other than you tend to concentrate on that law. And it's important that probation officers be aware of decisions in other circuits and how they may apply to a case at hand. The Institute earned high marks for many who attended as these final comments indicate. I have the impression that judges really care about what we think, and they want to see us. They want to hear from us about more departure issues. I definitely, from talking to a lot of the judges here, I have the impression that they don't feel that we've been identifying issues as often as we should, especially since the Coon decision. And they want to see us do it and do it within the framework of the guidelines itself to help them making their decisions. That's a biggie that I'm leaving here with. It is so useful for so many people. And it gives the opportunity for people to talk to each other and try to work through problems and to learn together. Because every day there are new changes. And every day there are accommodations that have to be made. And it reminds me that we all are working together for a common goal. Before we take you to New York for a change of pace, here's a reminder from the FJC about a couple of publications that we hope assist you in working with the guidelines. The Federal Judicial Center brings you in-depth coverage of guideline sentencing decisions. We send guideline sentencing update and its companion outline of selected appellate case law to probation and pretrial services offices nationwide. Both publications are also available on the center's JNET homepage. Guideline sentencing update and the sentencing outline, two tools from the center to help you do your job. So far in this program, we've seen how national sentencing policy is influenced by interaction among officials and government entities. Sentencing practice at the local level may also benefit from interaction. For example, the Southern District of New York recently took the lead in engaging the cooperation of other agencies to deal with a challenge the office faced. In the spring of 1997, New York Southern's probation office began to experience an increase in its pre-sentence investigations. Eventually, the increase became 39%. We were expecting choppy waters, but by September, we were seeing a tidal wave. And we really had to address that problem. Chief probation officer Chris Stanton and his staff did not think traditional solutions would work. They had a different idea. Why could we not have a group of officers who could do sentences, sentencing, pre-sentences, faster than Rule 32 reflects? Deputy Chief Mark Rosenfall had recently participated in the FJC's System Impact Seminar. The System Impact Seminar is a problem-solving model that teaches how to evaluate the problem and find solutions. And that's what we applied in order to create this program. The expedited sentencing program shortens the time to prepare the pre-sentence report and asks defendants to waive the second disclosure of Rule 32. I am a big fan of expedited sentences in the appropriate case. Everyone involved agrees that expedited sentencing is appropriate only for cases in which there's a plea agreement, there's no controversy, the guidelines calculations are not complicated, and there are no departure issues. And then if they answer my questions appropriately, I make explicit finding on the record that there has been a knowing and voluntary waiver of their rights under Rule 32. The clients are required to waive the time periods in Rule 32, but they're not required to waive the right that animates that rule, which is the right to have a sentencing based on accurate information. The probation office knew that the program's success depended on the cooperation of all agencies involved. I believe once they saw that it would benefit them as well that they were eager to participate. At heart, for every one of these cases, there's a person behind it, and that person is my client. And when I have clients who can benefit from the expedited sentencing program, I do what I can to make it happen for them. My office prosecutes over 1,000 cases a year, and so to the extent that this program facilitates the movement of several hundred cases on the calendar more quickly, that's a benefit to my office. We have a prison problem, a space to place our prisoners. And anything we can do to expedite moving prisons through the system is a benefit to us, not only in opening up more prison beds, but saves us a manpower holding prisons here. It cuts down the amount of times we have to move prisoners in and out. The heart of the program is the probation officers who volunteered to be on the expedited sentencing team, and their supervisor, Bernadine Fields. I'll call my counselor if I can do it today. Use your natural charm. I know New York has a lot of cliches, a lot of slogans, and one of them is the city that never sleeps. This team is what I'm concerned is the team that never sleeps. And the keyword is timeframe and speed. Okay, I'll let you know what I find when I do the rap sheet, and I'll call everybody to set the interviews up. Okay. It was the same work. We just do it faster. And I prefer to do it that way. Cuts down under procrastination. You know, you get the case, you do everything basically the first day.  Basically, you're rolling. It's not more work, but we have to provide the information more quickly. There's one thing when you call somebody and say, can you stop what you're doing? And fax this to me now. So we more or less have to, I guess, be nicer, just develop closer relationships with them and make them want to do that. But they really know what they're doing and they really know what's important and what's not important. You'll write the memo to the judge and you'll explain the circumstances. Did you've attempted to contact the defense attorney now? And whether or not the judge wants us to proceed and interview the defendant in absence of defense attorney. So as far as this nice number that shows up on that rap sheet, that's the brother's nice number. The expediting team and management agreed that several resources are essential. The officers have immediate access to administrative assistance to pick up and deliver documents. I need to get a rest reports. Pretty quick, there's two there. The officers are frequently mobile so cell phones are part of their arsenal, as are laptops and beepers because they often work at home or in transit. The dedication of the team and the cooperation of all agencies has paid off for the district. I've had enormous success in working with our probation department on the expedited sentence program. It increases the likelihood that I will actually remember the defendant when I sentenced them. We've been able to reduce the number of pre-sentence investigations assigned to the rest of our offices because of what the expeditors are doing. But the program is not only about numbers. You did your job, you did it well, you did not sacrifice quality for expediency and you can move on and feel good about starting with your next case. Now, a few items for your information. First, the latest news from the FJC. On April 12th, Chief Justice Rehnquist announced that the Center's Board selected District Judge Fern Smith of San Francisco as the new director of the Federal Judicial Center. Judge Smith succeeds Judge Riaz Obel who in July will return to the U.S. District Court in Massachusetts after four years as director. Since 1996, Judge Smith has served as chair at the Judicial Conference Advisory Committee on the Rules of Evidence. She's been a district judge in California since 1988 and has written and spoken extensively on evidentiary matters, trial practice, and other topics. Returning briefly to the subject of sentencing, the probation officer's role in recommending departures was a topic covered not only at the Sentencing Institute but also at recent new officer orientation training at the Center. Rusty Burra said the U.S. Sentencing Commission encouraged officers to be alert to situations that may warrant a departure recommendation. You will have this experience, you may not have it at this point, but you will develop this experience as though what looks like a typical kidnapping case? Does this look like the typical kidnapping case or is this unusual? What makes this case unusual? And does this factor make it unusual enough that you ought to go outside what the guidelines call for? And so always keep departures in mind because a departure is something part of the guideline system. And just as being a U.S. probation officer and looking at what are the factors that are appropriate for the application of the guidelines, you should also be looking in every case to see if there's something that might be an appropriate factor for giving a sentence outside of the guidelines. Jewel Owens is the latest recipient of the Center Certificate of Outstanding Achievement for her contributions to training and education. A supervising probation officer in the Eastern District of Michigan, Jewel has been on the faculty of more than 10 different center programs in the past decade. She's taught testifying skills, first-line safety, and other subjects in numerous districts. On a national level, she's served as faculty at New Officer Orientation and shared her experience with new faculty in the Train the Trainer program. We could go on at length extolling Jewel's hard work and dedication, but for now, we'll just say thanks, Jewel, and congratulations. The fourth class of the Leadership Development Program marked the completion of their three-year curriculum with a ceremony in the FJC's auditorium in Washington, D.C. Guest Speaker, District Judge Thomas F. Hogan spoke of the program's impact on the system. By getting into this program, you develop such strong leadership and leaders and managers that help you achieve your mission, which is essential in our court tradition that you become strong leaders. And Court Education Division Director Emily Heapner outlined the multiple roles of leaders in the future. They are being a negotiator, learner, advocate, resource manager, visionary, or planner. These roles have influenced our programs and what we have developed for you, and I hope that they will also influence the career and where you are heading from here. Program participant Danny Kuhn of the Southern District of West Virginia spoke for all of his colleagues. This group of experienced probation and pretrial services officers has benefited from many training initiatives over the years, but no experience has challenged us and helped us to grow like the Leadership Development Program. It has shown that opportunities to lead exist all around us. Awarding Certificates is the LDP's final event. And are in this project on the Offender Orientation Program for the U.S. Probation Office. But the knowledge acquired and the friendships made will stay with these officers throughout their careers. The Center is making available a 40-hour self-study course for supervisors. Foundations of Management was originally developed by the National Independent Study Center. Case scenarios and exercises have been adapted to reflect the work of probation and pretrial services managers. To request a copy, please call<PHONE_NUMBER>. Identifying and developing case management tools to assist officers with their pretrial supervision responsibilities is the focus of a study being conducted by the FJC's Research Division. The research is in response to a request from the Criminal Law Committee for a study to determine the usefulness of such tools for pretrial services. It builds on work that the Center has already completed to help probation officers carry out post-sentence supervision through the Risk Prediction Index. The first phase of the two-pronged feasibility study, an exploratory analysis of already automated pretrial data from the AO and the Sentencing Commission has been completed. The second phase, scheduled to be finished by the end of September 1999, involves collection and analysis of case file data from a sample of recently closed pretrial cases from five districts. We'll report on the study's results. As of this broadcast, the US Sentencing Commission remains without commissioners due to disagreements between the administration and Congress over nominees. Despite this, the staff continues its work on issues raised by previous commission members and congressional directives. Recently, the staff held its first public briefing for the commission's constituents. Probation officers, representatives from the AO and its federal corrections and supervision division, the Department of Justice, the Defense Bar and the US Parole Commission, as well as congressional staff, attended. Interim Staff Director of the Sentencing Commission, Jim McGrath, explained the briefing's purpose. So that you'll be able to engage us and then engage the commissioners in how you feel about the issues that they'll have to address when the new commissioners come on. The commission's Director of Education and Sentencing Practice, Sharon Hennigan, emceeded the briefing. We wanted to share with them things that we're working on, projects that we're working on. And we frankly wanted to let them know that we are working. We are without commissioners, but we continue to feel strongly about our mission of service to not only probation and pretrial, but the federal courts. Policy initiatives which were discussed included firearms issues, the Sexual Predators Act, the definition of loss, identity theft, telephone cloning, and the No Electronic Theft Act. As you may know, the relevant guideline obtained to intellectual property offenses is 2B5.3 copyright and trademark infringement. That has a base offense level of six and contains a specific offense characteristic that provides for increasing offense levels depending on a calculation using the retail value of the infringing item, that is the counterfeit item. And therefore it would appear on its face that some amendment to the guideline would be required to meet the second directive at least. Commission Chief Deputy General Counsel Andy Purdy reported on economic crimes. The staff's work in progress represents discussion with the Criminal Law Committee and review of the field test of the April 1998 proposed guidelines. Purdy elaborated on the definition of loss. Concerning actual loss itself, the April version said that losses reasonably foreseeable harm that resulted or will result. The January version said that it's the net reasonably foreseeable pecuniary harm that resulted or will result in the ordinary course of events. Purdy went on to say that the current version requires only a reasonable estimate of loss to determine the applicable offense level. The suggestion is that the courts don't have to come up with every single dollar in every single case of loss. And what you're trying to do is come up with a dollar amount that puts you in a certain range. And the new tables would move from one level increments to two level increments of loss to be broader amounts of dollar amounts in particular levels. And as long as they can support the finding that takes you to a particular level, less effort need be put into coming up with the exact dollar amount of the loss. Greg Hunt, head of the Sentencing Commission's Probation Officers Advisory Group, was pleased with the briefing. I thought it was excellent. I feel that they'll be ready to go forwards with those issues once we do have some commissioners. Hunt did raise a question about an issue not on the briefing's agenda, the reduction for acceptance of responsibility. And if it's an automatic reduction, then why not change the guidelines to make it a two level reduction when someone pleads guilty? And we would like to look at that issue and study it more thoroughly. On the briefing's agenda was information about the Sexual Predators Act. The legislation expands the definition of sexual activity. Now it includes crimes such as transporting minors for the production of child pornography. So the meaning of the term sexual activity no longer requires that a sexual act actually occur. Montgomery went on to explain that the act has six directives for the commission, requiring a look at several guidelines. And to add an enhancement, it's a defendant use a computer with the intent to persuade, induce, entice, or urge, or otherwise facilitate the transport of a child to engage in illegal sexual activity. Also at the briefing was AO Assistant General Counsel, Kathy Goodwin. We need this kind of information to be able to be informed and be able to move the process forward when a commission is established so that we have something tangible to respond to, both the probation officer's group and the committee. The commission staff felt the briefing was a success. In terms of what our mission was to share information and make sure that those who we work with understand that we're continuing to do the work that we can. We were very pleased to get that word out. Once again, we're delighted to welcome David Adair to bring us the legal perspective. David, good to have you back. Thanks, Robin. I'm glad to be back. I think we caught a glimpse of you and the audience in one of those panel discussions at the Sentencing Institute. Did you learn anything that you'd like to share with our viewers? You're right, Robin, I was there and the Institute was an excellent opportunity to learn particularly how different sentencing issues are handled by the various districts. Many issues were discussed, of course, but one that I found particularly interesting was not discussed in any detail and it's an issue that's as old as the guidelines themselves and that is who will defend the pre-sentence report when it differs from the stipulation of the parties? In fact, the pre-sentence report has no defender and it needs no defense. It's a neutral document prepared by the court's independent investigator. The role of the probation officer is not to advocate any position but simply to provide the court with an independent assessment and a recommendation. Naturally, the officer has an interest in assuring that the parties and the court understand the pre-sentence report but this should not lapse into advocacy. The court in United States versus Cifuentes recognized this and suggested that there was a line beyond which explanation of the report becomes advocacy and that is not appropriate nor is it within the legitimate role of the probation officer. But beyond theory, this is a frustrating issue for officers, I recognize that. It often seems like all the hard work that officers put into the pre-sentence report is ignored but even if it seems to be ignored in a given case it's still of critical importance in the guideline system to have an independently prepared pre-sentence report and there are several reasons for that. First, unless the court has accepted an 11E1C agreement the court's not bound by the stipulation of the parties. Second, the pre-sentence report serves as a check to the parties. It serves to ground the plea negotiations. If the parties know that an independently prepared pre-sentence report is going to be presented to the court they're going to at least consider that in their plea negotiations. Now this is particularly true when you look at it in the long run because even if the report is not followed in one case the parties are going to know that in the next case there's going to be another pre-sentence report that they have to consider. Third, and this was mentioned several times during the course of the Institute the pre-sentence report is particularly valuable in enabling the court to assess departures. The court, this is an area in which the court has judgment if not discretion and the pre-sentence report can provide valuable assistance. And if grounds for departure are included in the pre-sentence report this not only provides notice to the parties that the court may consider a departure but it may alert the parties to issues they hadn't considered or may state issues in a way that they hadn't considered. And that will help the parties in advocating appropriate departures. Fourth, the pre-sentence report goes to the sentencing commission for research purposes. The commission of course compares the report to the actual sentence imposed and that way is able to assess whether or not adjustments are necessary in the guidelines. And finally, the pre-sentence report goes to the Bureau of Prisons for classification and other purposes. So remember, this is not a contest. Even if the report is not followed in the given case the officer has not lost anything. It's the preparation of neutral and accurate pre-sentence reports are of critical importance to the entire system. It's good to know that all that hard work serves so many important purposes. That's right. Have there been any recent developments that officers should know about? Fortunately, Robin, nothing earth-shattering but one issue of importance to pre-trial services officers I think they should know about. A district court in the Northern District of Texas has found that the provisions of 18 USC section 3148B which permit the government to initiate revocation are the exclusive means to initiate revocation. In other words, if a pre-trial services officer presents a violation or information regarding a violation to the court as he must under the provisions of section 3154 the judicial officer does not have the authority to revoke release unless the government requests revocation. Now this case was United States versus Herrera. Now this is not a new issue. It's been around for some time. But I understand that in most courts the judicial officers have determined that the U.S. Attorney's Office and the judicial officer have concurrent authority to initiate revocation proceedings. Now Herrera also is not binding on other courts. Officers should remember this and I'm not suggesting that officers, pre-trial services officers do anything differently than what they're doing now. But if the issue comes up in your district you may find the opinion of the Office of the General Counsel helpful that appears on the JNET. It's a letter dated February 21, 1996. Okay David, how about any frequently asked questions that you think officers might be interested in? Well there were certainly frequent questions since we talked last but there is only one frequently asked questions that I wanted to bring to officers' attention in this program. And that concerns revocation proceedings. And the ability to add new grounds for revocation after the expiration of the period of release. And this is a situation that comes up when the officer files a Form 12 that sets out various grounds for revocation. Supervision expires. The officer then discovers new grounds for revocation, violations that occurred during the supervision period. My office had previously taken the position that at that point those newly discovered grounds could not be used in considering revocation. But in examining this question it appears that that position was not justified by the case law or statutory language. And it resulted in rewarding offenders for avoiding detection. So my view now is that so long as number one a warrant or summons is issued within the supervision period. Two, the newly discovered violation occurred within the supervision period. And three, the offender receives adequate notice of the new ground prior to the hearing. The court can consider these newly discovered grounds in determining revocation. Of course, even if the court doesn't use these new grounds for revocation, certainly the court can consider them in determining any sanction should the court proceed to revoke probation or supervised release. This is an issue that's explained in more detail in a letter that again is on the JNET and the letters dated May 9, 1996. Shall we remind viewers how to get in touch with your office? Well, that's a good idea, Robin, particularly since we have a new voicemail number. It's now<PHONE_NUMBER>. And again, I ask that officers try to exhaust local resources before they call. And if they use that voicemail number, the advantage of that is that we can do research and by the time we get back to officers we should have the answer to their question. David, thanks very much. Thank you, Robin. Before we finish up, a couple of reminders. Please note this date on your calendars. On July 29th, the FJTN will broadcast a two-hour program on mandatory restitution. The program will feature a step-by-step process for determining victims' and compensable harms for restitution purposes. It will highlight segments of a presentation made at the National Seminar on Sentencing Guidelines that will be held in May. Advanced registration is required. Please see the FJTN Bulletin for more details. Also, don't forget that Court to Court, the TV Magazine program for all court personnel, will air on June 17th with a report on how courts can handle high-profile cases such as the Oklahoma City Bombing and Unabomber Trials. It will also feature stories on managing death penalty cases and helping attorneys use electronic case filing. We hope you'll tune in to both of these programs. This has been our third edition of Perspectives. We hope the program has become something you mark on your calendar and look forward to. We've tried to be responsive to the ideas and suggestions we've gotten so far, and we're looking for more. What did you like most and least about this program? What do you wanna see in the next one? When you get back to your office, please fill out the Perspectives Evaluation form on the FJC home page. You can find that by going to the address on your screen and selecting online evaluation at the bottom of the Perspectives page. You can also fax your evaluation to us at<PHONE_NUMBER>. That's our program for today. Thanks again for joining us. Keep those emails and faxes coming, and we'll see you on September 16th for the next Perspectives.


Famous shot of him dissolving in the sunrise. It's a rookie mistake. How long have you been doing this for, man?  You don't remember what time to go to bed, do you? Yeah, exactly.


as well. So welcome back everyone on Moodle. Also welcome back people on YouTube. Today we will teach you how to create an R package. So the R package that we will create today is named your package name. So normally you would create a package which has a certain name like I came up with a new method for fish analysis, which is called fishy something, right? But in this case, because it's an example, the package is going to be called your package name, which is of course a little bit annoying because I'm making it harder for myself because every time I have to say your package name instead of using a name. And afterwards we will do some more advanced stuff. So I will also teach you how to use things like C code and call C code from R. Because a lot of times when you make an R package or when you write code in R, you end up with code which is sometimes relatively slow. I also notice now that actually the bottom of the slide is a little bit cut off. So let me move that thing up a little bit. Can I do that using this? Oh, that's going horribly wrong. There it goes. All right, so let's make the university proud. Like let's put the logo in. It's a little bit too big. Just all right, and sit like this, make it a little bit smaller, and then move it a little bit further down again. That's the wrong thing. That's also the wrong thing. All right, so let's make the university proud and show the logo as well. All right, I hope everything is visible and stuff doesn't get cut off on the bottom. So today package your package name. So first things first, when you want to create your own R package, you have to install the R compiler, which is different from R itself. So you have to install something called R tools, and you have to do that only when you are on Windows. So if you are on Windows, you go to this thing, and there you can download the latest version of R tools. You have to make sure that the version that you are installing is matching your version of R, right? Because the version of R that you are using needs to match the version of the R compiler that you are installing. Fortunately, the name is generally more or less similar to the R compatibility, right? So the thing that you want to download is the one which is having your version of R in range. So if you're using R 3.0, then you need R tools 3.1. If you are using R 3.1, then you need R tools 3.2. And of course, for the latest version of R version 4, there's also an R tools package available. And if you want to create the PDFs, because our packages come with documentation, so generally you want to also look if the documentation is generated correctly. For Windows, you also need to install something called Mixtex, which you can download from here. And this is big. I think Mixtex is almost 1.2 gigabytes to download. And then when you extract it, it's like 2 gigabytes on your hard drive. You can also install Mixtex for Linux, because under Linux, you also don't have Mixtex installed by default. But you don't need R tools when you are using Linux. Or if you're on Mac OS X, I also don't think that you need it. But I never did package development on Mac OS X, so I wouldn't know exactly. But on Windows, you need the R compiler and you need Mixtex when you want to make sure that the documentation is generated correctly. So first things first, you need to create a folder on your desktop or on a location that you know, right? So for this whole lecture, I will pretend like I made an empty folder on my desktop. And this is where I'm going to put the structure in. So our packages are all about structure. Structure is everything. So the structure of the folders inside of this folder that you're going to create, so the create your folder on the desktop. So in my case, because my package is called your package name, I have to make a folder which is called your package name. The name of the folder has to match the name of your package. And the structure, so everything that you put inside of this folder needs to adhere to the official guidelines. And you can click on this link and find the official guidelines. If you click on this link, you will see that the official guidelines is around 600 pages, a PDF file. So there are like 600 pages of guidelines that you have to adhere to. And we're just going to boil it down now to a 15-minute lecture. And I'm going to go through more or less all of it. And then you don't have to read this whole 600-page document. So I did that for you, so you don't have to do that. All right. So took a roll, redeemed, next slide in Dutch. Good. So the first thing we're going to do is we're going to go to the command line, the command prompt, or what's summer to say, in Windows. So in Windows, if you use Windows, then it's called the command prompt. And the command prompt is advanced stuff, right? So it's very difficult. Because most people who use Windows do point and click.  But how starts your command prompt in Windows? Well, it's very simple. You press the Windows to, or you press your start button for Windows. So in Windows 7 it looks like this. And you type CMD. And if you type CMD, then you have one program that matches CMD indexes. And then you can click or you just press enter at the moment that it is selected. All right. I think it's pretty obvious what this slide does. There's not a lot of text on it. So it's an easy slide to do in Dutch. But then we're going to execute R from the command line. And executing R from the command line is just pressing the Windows key, and then typing CMD. And then one program should come up. It's always installed because it's a Windows default thing. And it's called CMD.exe. And when you click on it, it looks more or less like this. It's not the best redemption. So this slide is just an empty slide. Like it's just showing you how it looks on the Windows 7. But this is something that people generally in Windows never touch. I will redeem your points so you can use the thousand points later on for another slide or in another lecture. But I can't do that now. I think my moderator should be able to, but I don't have to. I just have the OBS open. So I can't redeem them now, but I will redeem them later on. So this is how it looks. So the first thing that we need to do is check the package. You could translate all text in the screenshot. But it's just English. And it's also German because it already says, alle Rechten vorbehalten. Don't worry, I have 5k more points. No, it's not called Mikroweigfenster. That's actually my username on my computer here, but whatever. Yeah, you guys should have been earning a lot of points. Like there's not a lot of things that you can do with channel point redemptions. Or like if you have some ideas what you guys want to do with your channel points, then let me know. But they're Danny bucks, right? And spend your Danny bucks on something, but I don't know exactly what. So anyway, Mikroweigfenster. No, it's not Mikroweigfenster. It's just Microsoft Windows. Anyway, so creating your package is just a loop again. So we're going to do the same thing over and over again. And the first thing that we want to do is checking our package, see if the package so that the empty folder called your package name that we created is actually a valid one. So in the in the in the command window, we type CD desktop, because that's where I made it, right? So I was in C users, user two. And then I have to go to the desktop folder. So I just type CD desktop, and it goes to the desktop. And then I do this magic command saying our CMD small letters check your package name, which is the name of the folder. And then what will happen? It will look like this, right? So it will tell us so I do CD desktop, and then I do our CMD check. And then it says, okay, I'm using this log directory. This is the R version that I'm using. So 3.1.0. I'm using a 64 bit windows. I'm using minimal GNU for Windows to compile. I'm going to compile 64 bits. It's using this character set, which is ISO 8859, which doesn't really matter. And then it checks to see if there's a file. And this file is called your package name slash description. And it says no, right? And that is because everything is about structure. So you need certain files to be there, and you need certain folders to be there as well. So apparently, there needs to be a file called description. And this is something that is hard under Windows, because this description file, this file called description written all in capital letters is not allowed to have the TXT extension, right?  So I'm going to open up a new a new text document in notepad plus plus, for example. And then when I save it, I have to save it as description. So no dot txt at the end, because if there's dot txt, then it won't recognize it as a valid description file. So inside the file, we add the following. So we say this is a package double point, your package name. I'm going to save version double point, and I'm going to give it a version. And this version is a semfer version, which means that it is 0.0.0 dash one. And you can, of course, make it version 1.3.2 dash a, but it has to adhere to this structure. The date at which it was created. So the first time that I did this lecture was the ninth of June 2015. I have to give a title. So the title is called my package. The title is just a sentence, which I can choose freely. The author needs to be mentioned. So the author is me, Danny Adams, and my email address between the larger than and smaller than characters. And I need to specify a maintainer. The maintainer is the person who's going to maintain the package long term. And this is the email address that will be mailed. So they will when, for example, there's an error in your package. And so I submit my package to cram, and there's an error. Then the people from cram will start mailing the author and the maintainer. So the maintainer will get an email. If the maintainer doesn't respond, then they are mailing the author. But in this case, it's both the same. I have to specify what my package need, which is called the dependency. And the dependence is specifying that. So I'm going to specify that you need to have r installed. And you need to have r at least equal to or greater than version 3.0.0, right? So and this, of course, if you want to write software, which is also for older versions of r, then of course, you can specify, well, I need to have r 2.8.1, right? But of course, depending on which version of r you are targeting, some functions might be available in the standard library and some might not. So generally, you always target the version that you have installed yourself. So the description is just one sentence, which is my first r package. And you have to specify a license. And this license, you have to choose from a list of approved licenses, which is available on the website. Next lecture in Dutch, I guess. You want to have the whole lecture in Dutch. I don't think that many people will start understanding that. Perhaps the Dutch people will like it. But I think English is better. But I generally go for GPL3. There's different licenses that you can choose from. And this depends on what you want to do with your code, or if there are any restrictions that are there because of the university that you're working for. Some universities only allow you to do things like CC by attribution. But in this case, it's just a GPL3 license, which means that you can do anything with it. But if you do anything with it, you have to mention that I made the original package. And if you change something in the package, then you have to contribute that back to me. And those are the only two requirements for the license, more or less in a GPL. But if you're interested in licenses, we can talk a whole lecture about that. But it's not that interesting here. All right. So again, we do the same thing. So I create this file called description in this folder. And then I'm going to do our CMD check your package name again. And now, of course, it finds this description file here. So it says okay. And then it starts doing all kinds of other checks. And then in the end, we are almost there. But we see that there is one note, right? So there's one note. And that says packages without our code can be installed without a namespace file, but it is cleaner to add an empty one. So let's do that, right? Because we want to have a package that is perfect, right? We don't want to have any notes or warnings or these kinds of things. No, we want to have a package which is fully fine. So it says that we have to create a namespace file. So let's create a namespace file. The reason why we need a namespace file is that we might want to load dynamic libraries, right? We might want to load other R packages. Or we might want to load like Windows DLLs, or we might want to load DLLs or SO objects, which are available on Linux. So that is the reason why it is there. And it names all the functions that are available to the user, right? So normally, I have to specify a list and own. So if I make a package, then I have to tell R that this package contains the following functions. And only those functions will be visible to the user. All the other functions will be hidden. So I'm creating a new empty file called namespace. Again, no.txt is allowed at the end. And inside of this file, I add the following, right? Because I don't want to create a package without any R code. But I want to give at least one function to the user. And the function that I'm going to give to the user is called my first package function, right? So in your case, when you have, for example, some code that does underworld, no, thank you for following. Thank you for following underworld. Welcome to the lecture. So in this case, we're just going to give one function to the user of our package. And this is called my first package function. So of course, we have to make this function. But first, I'm just going to make the file. And I'm going to say, this is the function that I'm going to export. Of course, I now need to create a folder to hold the R code. So I'm going to add a folder called R, capital R, right? So if I look now in the Windows Explorer, then if I go into your package name, what did I call it again? Your package name. So I go into the folder, your package name. And now it looks like this, right? So I have a description file, I have a namespace file, and I have an empty folder called R, right? But the folder called R with the capital will contain all the R code files. And I have a very specific structure. And this is not required. But normally, I have one file, one function. So the file has the same name as the function that is in the file. And that is easy, because then if there's an error in a certain function, then I can directly open up the file, because I'm using one file, one function. But it's not required. But it's a good thing to do. So let's create an R code file, right? So in the R folder, I create a new file. And this is what I put in. So I, of course, put in a header, which is very important. I'm going to say the file name. So my first package function dot R, the copyright is by the group that I'm working for, but also by me, it was last modified and it was first written. And I'm just going to make an empty function. So my first package function. And I'm going to say this is a function, it has no input parameters. And it does not do anything. And I save it into the R folder. So now we have everything that we kind of need, we have our description file, we have our namespace file, we have our R folder containing the R code, and we have our file containing a single function that is mentioned in the namespace file, which is going to be given to the user. All right, let's check. So we do our CMD check your package name. Again, it will roll all kinds of diagnostics into the screen. But it says now a warning. Okay, so what is the warning? So the warning says undocumented code objects, all user level objects in a package should have a documentation entry. See chapter writing our documentation file in the writing R extension manual. So now you have to pick up the 600 page manual, you have to go through it, you have to find this section. But of course, you don't really have to because you're watching the lecture. So we're just going to tell you what you need to do. But this is one of the things which is fundamental in our every function inside a package needs to have a documentation. So there needs to be a help file describing what the function does. It needs to give an example. And there are some other requirements to the help file. All right, so help files are in a folder which is called man small letters this time. Any other structure won't work and capitalized and small won't work. No, it has to be called man. This will hold all the manual files. And again, I normally have one file, one function, right? So now this thing, so I create a new month file, and manuals have the extension rd. So the way that it looks now on the hard drive is that I have a namespace file, I have my description file, I have my r folder in which there is my first package function dot r, and I have my manuals. And there I have one file called my first package function dot rd. So the rd files follow a very, a structure which is very similar to Lathech, which is a layout language. And this is what you just can copy paste in, right? So this is the most basic r data file that you can make. So you have to specify the name. In this case, it's called my first package function. You can specify an alias, you have to specify the name as an alias, but you can give multiple aliases, because you don't have to have, you can have multiple names for the same function. You have to specify a title, so my first package function, and then you generally do a minus and then a short description. So like a four, five, six word description on what it does. And then you have a description field to provide a very long description, which can be up to like a four of text. We then have a usage section, which explains how to use the function. So in this case, the function doesn't have any parameters. So the way that you use it is just my first package function open close arguments, you have to specify them, even though we don't have any arguments, I'm just going to say to do add details. Then we have details, and we have to specify the details, what does this function do. So this function doesn't do anything, but I still have to write something here. So I'm just going to say to do add details, because I'm going to have to fill this in later on, when the function does something. Then I have the value. So the slash value contains a description of what the function will return. So the return value of the function is described here. But in this case, since it doesn't return anything, I'm just going to say to do add a return value. And then I have the example section. And the example section needs to be specified. So the example here as an example, we execute the function. So since we have no parameters, no return value, I just say my first package function, call it. And then I have to specify keywords. And in this case, this is a method, right? So it's a function that I'm giving to the user. And that is called in our a methods. So it just needs to say keyword methods. And you can freely choose this, you can only say methods. And I think there's like data and a couple of other ones. But in this case, since it's a function, it needs to have the keyword methods. All right, so we retract, recheck the package, because we changed something. So we do our CMD check your package name. And perfect. So we just created our first R package. It is that easy. It is all about structure. You only have to create four files at the minimum. And you just have to make sure that everything kind of lines up. So step one is learn how to build an R package. Then there's a question mark. And then there's profit, probably. Of course, we also need to install the package, right? Because we just checked the package, which means that it's not yet installed in R. So we can also install the package from the command line. So we can say, our CMD install, this time with capital letters, your package name, and then what it will do, it will start installing it. And then it ends with done. And then we have created our first R package. So very easy. Just follow the structure. Of course, we need to test it, because we open up R and then we load our library. So we load the library, your package name, I call the function, which does nothing, but I have to test or I want to test make sure that everything works. And then of course, I'm also going to test if the help file works. So I'm going to do question mark, my first package function, and then we'll open up the help file. And of course, the help file will not have a lot of things in there. But it's just a way. Of course, we can make this much, much better. So any questions, because that's, that's how you make our packages. So if you just have our code, you just put one function, one file, create a manual file for all of them, fill in the required sections, and then compile your package and do this. Good. Then we will do more advanced stuff. So there are some special files that we can provide. So one of the things that we can provide is a package description file, right? So this is the general description of the whole package. This file is called mon slash your package name minus package dot rd. It is the global package description. And it is more or less an index. So it's kind of I've had this package contain 17 functions, which are related to hamster management. And these are the different functions. And if you want to do hamster breeding program function number three, you can find it here. The other one that you want to have is an internal one, because generally, there are a certain amount of functions that you give to the user. But there are also some functions that you need for yourself, which are only used within the package, but are generally not available for users. So because all functions need documentations, these small internal functions that are not used by the user, you can store here, you can you can refer to them, right? So if I have an internal function, which the user shouldn't see, it still needs a documentation file. But I just say that the your package name minus internal has a new alias to the function that I create. So I'm we're going to show you so you're using the alias field for this. So all of the internal functions, when people ask question mark, internal function name, then it will go to this kind of internal document where it just says that, well, this is a function that is generally not called by the user. So the your package name minus package.rd follows this structure, right? So this is has a keyword, which is called package. And this is a smaller thing. So it's just called the name is your package name minus package. It has an alias, it has a dock type, which is package. So it formats it as the index page, it has a title, it has a description, it has details, and it has an author and a maintainer section. And that's it. And then it has keywords package. And of course, the details can be long as long as you want. So you put all of the text describing your package there. And the description is just a long description of what your package does. Generally, like one paragraph, and the details are very detailed on which functions are provided and which publications people should cite and these kinds of things. The internal one looks like this. So if you have internal functions that you use to do your computation, but that you don't want the user to call, then you can link them to here, right? So you say this is the name is your package name minus internal, the title is internal functions. And then we define all of the different functions that we want to link to this file as aliases. So imagine that I have three internal functions, internal function one, two and three, then by aliasing this file to all of these three functions, I have one documentation file, and I have three different files in my r folder and all of these link to this one documentation. And the description is generally something like internal functions, generally not called by the user. You do have to specify the author, like who wrote the internal functions. And it has the keyword internal. All right. So something else that you can do and which is done a lot in our window, in our packages is to provide data, right? Because generally, if you did some research and you wrote some code, then of course, you have data, which is used by your code, or which functions as a test case, right? Because you have measured some snails, and these snails, they, they, you have your measurement and then you have your code, and the code works on these measurements. And then you have some output, which you kind of computed before. But if you want to give this data set that you generated to the user, you can do that in the data folder. So the data folder is written with small letters again. And data is stored as a name dot R data. And here again, R is capitalized, D is capitalized, the other two or other three are small. For data files, the same thing holds every data file that you provide in R to the user has to have a manual file. So again, when we create a random matrix dot R data, we have to also create a manual file describing that there is a data set, who collected it, when it was collected, how it is structured and these kinds of things. For example, we can save a random data matrix, right? So I just make a random matrix, which is a matrix, which contains 1000 random numbers, 100 rows, 10 columns, and I just save it in R using the save function, because I need to have a binary R object. So I just say save random matrix to the file data slash random matrix dot R data, right? Then we create our manual file describing the data set, which is stored in month slash random matrix dot RD. So it has a name. Again, it has an alias. The doc type is data. So that R knows that this has to be formatted as a data kind of section. It has a title. It has a description. It has a usage section. The usage section for data is always data. And then the name of the data set, then we have to specify the format, which describes how the data is formatted, like this is a matrix containing 12 rows and 500 columns with measurements on snails. The details are, for example, data was collected by me on January 15, 2025, and these kinds of things. And the references, so the references are references to the data collection. So for example, your publication where you publish your data.  So just data random matrix. But again, every manual file, except for the internal and the package file, they need to have an example because that's just the requirement in R. And of course, here we have to use keyword data sets so that R knows that this data or that this manual file describes a data set so that it belongs to something in the data folder. All right. So besides, because the examples we have to provide because R uses your examples as tests. So when you when you do our CMD check your package name, it goes through all of the help files and it runs the examples to make sure that there's no error on the examples. However, we can have more tests because we might want to have that we might want to test certain parameters to our functions that we don't test in the examples. So tests go into a folder called tests. And generally, I use a structure like this. So I just say test underscore 0001 dot R. So create a folder called test and our files in this folder will be executed automatically during the building of the package. So when you do our CMD check or when you do our CMD build or you do our CMD install, it will run the test to make sure that all tests pass. So it gives you more certainty about that. I changed a little bit in the code, but the output of the test should not differ now, right? Because you can, you can imagine that if you have something which computes the mean, and then you can test if you take five numbers and you know what the mean is, then the test will just calculate the mean using your function and then compare that to the to the overall mean of the test. All right, so you can add more tests if you wanted to and those go into the test folder or tests folder, which is also written with small letters. So for example, how did I do one of the tests? So this is a test which fails randomly. So I just draw a random number, which is larger than 0.8. And then it will say stop unsuccessful test. So this will cost 20% of the compiling or the checking of the package to fail, because there is a failing test, which is of course not a good test. But test failure is just calling the stop function, right? So normally, you would say, well, call my very complex function, store the result, compare the result to something that I know. And if this is not the case, then throw a stop error. So you can use stop errors to make sure that your test can fail. All right, so there's another folder that you can use in our packages, and that is SRC. So the SRC folder contains source code. So it holds for Tron or C code or C plus plus code that needs to be compiled when you build your package, right? Because R is a language which allows you to also call into C or call into C plus plus. So I just want to show you a basic example on how you can do that. So in the end, if you ever end up in a situation where you have R code, which partially depends on C code, then you can use the SRC folder to provide that to the user. Could someone band the spam in chat? And that's a request to my moderator though. Right, so that's perfectly fine. All right, already banned. Very good, very good. Thank you, moderator. Right, so if I have for Tron code or C or C plus plus code, then I can use that code in R as well. So I'm just going to give you a very quick basic example on how you can call C code from R. So first things first, we need to have a C code file, right? So I'm creating a new file, which is called SRC slash call test C from R dot C. In C plus plus or in C, comments are not hashtags, but they are like double slashes, or a multi line comment can be slash star and star slash ends the multi line comment. So again, of course, I always provide a header. And the only thing that this thing is going to do is take two pointers to integers and a pointer to a result. And it's just going to add these two together, and then store this in result. Right, so it's a very basic C code, which you could also do in R. But for this, we are just going to take two numbers, add them together, and store them in the result. So it's a function with three parameters, two integers, so whole numbers, and a resulting number, which is also a whole number. And this is the way that you do it in C. And I'm not going to teach you how to program in C. But if you are capable in programming in C, then you kind of know that here we dereference the pointer of A, plus the dereference of the pointer of B. And then we store this into the position which is pointed to by the result point. But that's just a little bit C code. Then of course, we have to create an R file. So we create an R file called R slash call test C from R dot R. Again, we add a header, we of course have this function saying, so the function is called call test C from R, which is a function, it takes two names or two parameters as input, A and B. So the numbers that we want to add up, it has an internal variable called results, where we are going to store the result of the computation. And then calling C code in R from your own package is as easy as just doing dot C, specify the name of the function. So the name of the R function. So in this case, it's R underscore add, which is slightly yeah, so it's which is similar to the to the name of the C function. And then I'm going to say, well, this R underscore add function takes three parameters, it takes a so as integer a, as integer B, and then it takes something called result, which is as integer result. So I just couple the two input parameters from the R function to the two input parameters of the of the C function, and I'm coupling the result internal parameter in R to the input parameter of the C code. So this calls the C code, and it returns the result. So it returns the whole result, which will contain A and B and the resulting value. Of course, we have to add a manual file for this function, because every R function needs to have a manual file. So we have to now also update the namespace file, because we need to export this function to the user. But we also have to use, we have to add this use dinlib function, because we are now using our own dynamic library, right, because we have C code, which gets compiled, which then gets distributed with our package. So we need to inform the package that when it starts up, it needs to load this your package name dot DLL, which is automatically compiled by R when the packages is made. So the use dinlib function here loads this dynamic library. So the library containing the C code or the Fortrum code or the C plus plus code. And of course, the export, because we now have a second function that we want to offer to the user, we need to export or expose this call test C from R to the user of our package. We create a manual file. So in this case, the manual file is a little bit different than the one that we had. Because now if we look at the usage section, we have to specify that there are two parameters that the user needs to provide, right, the user needs to provide an A and a B parameter. So in the arguments here, we also need to specify that we have two items. So the first item is item A, which is the first number to add up. And then we have an item B, which is the second number to add up. And of course, the value here would be, we can update that as well, because the value is the return value and the return value is the sum of A plus B done using C code. Of course, we now test the package again. So we do our CMD check. And this should not throw any errors, notes, or warnings. And then we do RCMD install. This should install the package, make sure that the R window is closed. You should never install a package while you have the R window open in R, because then it won't be able to override the DLL, so the C code or the R code, right, because it needs to override it. So when you do RCMD install, make sure that you have no R windows open. And now we can see if our new code works. So we do library your package name, and then we say call test C from R 5 comma 10. And then it will return this. So it will return the two input parameters, plus the result, which is computed in C. All right, so some common mistakes when building R packages, when you install a package, make sure that R is not running, because the code might not update. And that is because the file might be in use or R might have locked the file when you loaded the library. So you should always make sure that when you install a package from the command line, to make sure that all R windows are closed, always check your package before installing. Because if you don't run RCMD check, then you cannot see if there's anything wrong. And then when you do RCMD install, it will try to install it. And then the installation will fail, but it won't tell you why. So the RCMD check will tell you why stuff is failing. And make sure to add enough testing in the test folder. Have used the documentation for quick and simple tests or an example how and how people should use it. But if you have code which requires more thorough testing, then of course you have to use the test directory. And you can put in five or 10 or 100 tests in there. All right, so the created package can be found on Moodle. Not yet, but at the end of the day. So after the lecture finishes, I will upload my your package name to Moodle so you can get it from there. So you can look at how I made this very simple package. Although the assignment for today is creating a package. So try and create it first based on the slides. If that doesn't work, just look at the example package on Moodle to see how I did it. So all right, so that's it for this section. So we're nicely on time. I gained some time by talking a little bit faster. And it's now 403. So any questions about our packages and how you can make them? So it's all about structure, right? Things need to be in the correct folder. They have to have the correct name. Sometimes a file is not allowed to have an extension. And you can put a random file somewhere. So you're not allowed to just create a temporary file somewhere and just give it a name because everything is about structure. So every file that is in there, that is not according to the specs of the 600 page document will cause your package to be rejected. So it's very diligent work creating an R package. But it's rewarding work because from that point on, you can submit it to cram. And people can just do install the packages, your package name, and then they can install your package from anywhere in the world and use your code, which is a very good way to not just get citations on the research that you're doing, but to also earn citations and like track record or like for your career as a scientist, so that people can also cite the code that you made, so the work that you put in to create the analysis code. All right, I see no questions in chat. So is everyone still awake? Like, didn't we boil down to kind of a nothing yet? Like, I'm sweating like mad here. So everyone's still awake? No, I'm just talking to myself and commander root shout out to commander root for always being here. He's one of the bots that monitors channel. So he's always there. All right, Florian is also still here. Very good Florian awake, tired, but awake. All right, very good. So like, you guys think that you can make an R package after this very short introduction? Let me stop the recording here for the people watching on YouTube and the people watching on