Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7912153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:31:24+00:00 2026-06-03T13:31:24+00:00

I work in a school district and plan to produce unique PDF reports that

  • 0

I work in a school district and plan to produce unique PDF reports that I will send to a shared drive containing a folder for each of the 40+ schools in my district.

I am trying to set the working directory within my for loop so that each school will get a report tailored for their school. The schools files are named based on the levels of some variable named “school_name” and now I want to write to those folders based upon the fact that I am using data for school[i].

schools <- levels(as.factor(data$school_name))
for (i in 1:length(schools)) {
  setwd("W:\\Data Analysis Results\\"paste(schools[[i]]))
  ## some command to create a unique PDF report for school [[i]]
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T13:31:29+00:00Added an answer on June 3, 2026 at 1:31 pm

    This minor change should do it:

    schools <- levels(as.factor(data$school_name))
    for (i in 1:length(schools)) {
      setwd(file.path("W:/Data Analysis Results", schools[[i]]))
      # some command to create a unique PDF report for school [[i]]
    }
    

    The file.path function is made for these tasks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a system that allows our parents (I work for a school district)
I am currently developing a database system for a school that will work with
I am doing work for school, I'm supposed to write a function that accepts
I work for a local school district part time. They run a piece of
I work for a school district in which the teachers submit their lesson plans
This problem may seem like school work, but it isn't. At best it is
I work in a group that does a large mix of research development and
I'm trying to work with regexes in PHP on my school's news site (running
I have to install object store for a school project and it doesn't work
How do sprites work? I've seen sprites from old school games like Super Mario

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.