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 8542569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:06:04+00:00 2026-06-11T12:06:04+00:00

I have tried a few proposed solution in here. But it was not working

  • 0

I have tried a few proposed solution in here. But it was not working for my case.
I have a code, here:

a <- read.table("Whirr_127.csv", header=T, sep=",", row.names=1) # task assignment / people vs task
b <- read.table("Files_Whirr_127.csv", header=T, sep=",", row.names=1) #task vs files 
a
b

#calc cr , cr = ta * tf * transpose(ta)
cr <- as.matrix(a) %*% (as.matrix(b) %*% as.matrix(t(b)) %*% as.matrix(t(a)))
cr

#set value to 1, to initialize table
cr[cr>=1]<-1
cr

#identify diagonal matrix, set to zero
cr<-as.matrix(0,ncol=ncol(cr),nrow=nrow(cr))
cr<-diag(cr,x=0)

I want to set diagonal value as zero. It seems the code used in the last two lines are not working for my case.

Also, I would like to used the file name in a, and saved it as AB_Files_Whirr_127.csv
I tried to use

write.csv(cr,file = paste("CR_", a,".csv")

but, nothing appear in my directory.

sample output for cr:

               Adrian Cole Alison Wong Andrei Savu Bruno Dumon Edward J. Yoon Eugene Koontz Jakob Homan Kelvin Kakugawa Kirk True Lars George Soren Macbeth Stu Hood
Adrian Cole               0           0           0           0              0             0           0               0         0           0             0        0
Alison Wong               0           0           0           0              0             0           0               0         0           0             0        0
Andrei Savu               0           0           1           0              0             0           0               0         0           1             1        0
Bruno Dumon               0           0           0           0              0             0           0               0         0           0             0        0
Edward J. Yoon            0           0           0           0              0             0           0               0         0           0             0        0
Eugene Koontz             0           0           0           0              0             0           0               0         0           0             0        0
Jakob Homan               0           0           0           0              0             0           0               0         0           0             0        0
Kelvin Kakugawa           0           0           0           0              0             0           0               0         0           0             0        0
Kirk True                 0           0           0           0              0             0           0               0         0           0             0        0
Lars George               0           0           1           0              0             0           0               0         0           1             1        0
Soren Macbeth             0           0           1           0              0             0           0               0         0           1             1        0
Stu Hood                  0           0           0           0              0             0           0               0         0           0             0        0
Tibor Kiss                0           0           0           0              0             0           0               0         0           0             0        0
Tom White                 0           0           1           0              0             0           0               0         0           1             1        0
Unassigned                0           0           0           0              0             0           0               0         0           0             0        0
                Tibor Kiss Tom White Unassigned
Adrian Cole              0         0          0
Alison Wong              0         0          0
Andrei Savu              0         1          0
Bruno Dumon              0         0          0
Edward J. Yoon           0         0          0
Eugene Koontz            0         0          0
Jakob Homan              0         0          0
Kelvin Kakugawa          0         0          0
Kirk True                0         0          0
Lars George              0         1          0
Soren Macbeth            0         1          0
Stu Hood                 0         0          0
Tibor Kiss               0         0          0
Tom White                0         1          0
Unassigned               0         0          0
  • 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-11T12:06:05+00:00Added an answer on June 11, 2026 at 12:06 pm

    a cannot be used in the name of the output file as it is not a character variable, it is a data frame.

    infile <- "Whirr_127.csv"
    a <- read.table(infile, header=T, sep=",", row.names=1)
    ....
    diag(cr) <- 0
    write.csv(cr, file = paste0("CR_", infile, ".csv")
    

    The syntax of the diag line tends to look funny to new R users, but it is actually just an alternate syntax to call the assignment function diag<-, i.e. diag(x) <- 0 is interpreted as diag<-(x, 0).

    Update: Multiple files

    If you want to repeat the above for multiple paired files you can do this.

    a.files <- grep("^Whirr", dir(), value=TRUE)
    b.files <- paste0("Files_", a.files)
    for(i in length(a.files)){
        a <- read.table(a.files[i], ...)
        b <- read.table(b.files[i], ...)
        ...
        write.csv(cr, paste0("CR_", a.files[i], ".csv"))
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried a few fixes but none work. I am working on the
I'm not exactly sure how to properly debug this but have tried a few
I have tried quite a few codes but none of them seem to work
I've seen a few similar posts and have tried out the answers given, but
I have been staring at this code for few hours, tried walkthrough,debugging with autos
I have tried searching over the internet about this problem but not able to
I have tried a few things to solve this problem but I can't seem
I have tried a few different fixes using JQuery and CSS Tricks, but I
I have tried a few approaches but none worked. Does anyone know a the
I have tried a few options but none seem to work, and some send

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.