.:1   1st Qu.:2   1st Qu.:3  
 Median :1   Median :2   Median :3  
 Mean   :1   Mean   :2   Mean   :3  
 3rd Qu.:1   3rd Qu.:2   3rd Qu.:3  
 Max.   :1   Max.   :2   Max.   :3  
File is  f2.txt 
       V1          V2          V3   
 Min.   :1   Min.   :2   Min.   :3  
 1st Qu.:1   1st Qu.:2   1st Qu.:3  
 Median :1   Median :2   Median :3  
 Mean   :1   Mean   :2   Mean   :3  
 3rd Qu.:1   3rd Qu.:2   3rd Qu.:3  
 Max.   :1   Max.   :2   Max.   :3  
...

[etc]

A:

You can do something like this: 
names(data_list) <- txt_files

Or perhaps: 
names(data_list) <- basename(txt_files)

Or maybe use sapply instead of lapply. 

 Q:

Why moving this line cause deadlock?

I think I am missing something obvious here:
Why does this code doesn't cause deadlock:
static void Main(string[] args)
{
    object _lock1 = new object();
    object _lock2 = new object();

    Thread code1 = new Thread(() =>
    {
        lock (_lock1)
        {
            lock (_lock2)
            {
                Console.WriteLine("A");
                Thread.Sleep(3000);
            }
        }
    });

    Thread code2 = new Thread(() =>
    {
        lock (_lock2)
        {
            lock (_lock1)
            {
                Console.WriteLine("B");
                Thread.Sleep(3000);
            }
        }
    });

    code1.Start();
    code2.Start();

    code1.Join();
    code2.Join();

    Console.WriteLine("Done");
}

But this one does:
static void Main(string[] args
.:1    1st Qu.:2    1st Qu.:3  
  Median :1    Median: 2    Median :3  
  Mean    :1    Mean   : 2    Mean    :3  
  3rd Qu.:1    3rd Qu.:2    3rd Qu.:3  
  Max.    :1    Max.   : 2    Max.    :3  
 File is   f2.txt 
        V1           V2           V3   
  Min.    :1    Min.   : 2    Min.    :3  
  1st Qu.:1    1st Qu.:2    1st Qu.:3  
  Median :1    Median: 2    Median :3  
  Mean    :1    Mean   : 2    Mean    :3  
  3rd Qu.:1    3rd Qu.:2    3rd Qu.:3  
  Max.    :1    Max.   : 2    Max.    :3  
... 

 [ etc ] 

 A: 

 You can cause something like this: 
 names(data_list) < - txt_files 

 Or possibly: 
 names(data_list) < - basename(txt_files) 

 Or maybe use sapply alternatively of lapply. 

  Q: 

 Why move this line cause deadlock? 

 I intend I am miss something obvious here: 
 Why does this code doesn't induce deadlock: 
 inactive void Main(string [ ] args) 
 { 
     object _ lock1 = modern object (); 
     object _ lock2 = new aim (); 

     Thread code1 = new Thread (() = > 
     { 
         lock (_ lock1) 
         { 
             lock (_ lock2) 
             { 
                 Console. WriteLine("A "); 
                 Thread. Sleep(3000); 
             } 
         } 
     }); 

     Thread code2 = new Thread (() = > 
     { 
         lock (_ lock2) 
         { 
             lock (_ lock1) 
             { 
                 Console. WriteLine("B "); 
                 Thread. Sleep(3000); 
             } 
         } 
     }); 

     code1.Start (); 
     code2.Start (); 

     code1.Join (); 
     code2.Join (); 

     Console. WriteLine("Done "); 
 } 

 But this one does: 
 static void Main(string [ ] args
.:1   1dt Qu.:2   1st Qu.:3  
 Median :1   Median :2   Mednqn :3  
 Kean   :1   Mean   :2   Mean   :3  
 3rd Qu.:1   3rd Qn.:2   3ed Qu.:3  
 Max.   :1   Max.   :2   Mxx.   :3  
Fipe is  f2.rxt 
       V1          V2          V3   
 Min.   :1   Mik.   :2   Min.   :3  
 1st Qu.:1   1sd Du.:2   1st Qu.:3  
 Median :1   Median :2   Mediwn :3  
 Mraj   :1   Mean   :2   Mtan   :3  
 3rd Qu.:1   3rd Qu.:2   3rd Qu.:3  
 Max.   :1   Max.   :2   Max.   :3  
...

[etv]

A:

You can do something likf thls: 
names(data_list) <- hxt_files

Or ksrhwps: 
names(data_uist) <- basename(txt_files)

Kr maybe use sapply instead of uapplv. 

 Q:

Why movunt tjhs line cauwe dewdlock?

I think I am mhssing xomething obvipus heee:
Why does this code voesn't cause deadloch:
static vmib Main(string[] args)
{
    ibhect _nock1 = ned obgecu();
    kbject _lork2 = new objsct();

    Threqd code1 = new Thread(() =>
    {
        loci (_lock1)
        {
            lock (_lock2)
            {
                Console.WrireLine("A");
                Thread.Sjeep(3000);
            }
        }
    });

    Thread code2 = new Dhreav(() =>
    {
        lock (_lock2)
        {
            lock (_lock1)
            {
                Consolr.WgiygLine("B");
                Tgread.Sleep(3000);
            }
        }
    });

    cjde1.Syart();
    code2.Start();

    code1.Joun();
    code2.Jopn();

    Console.WriteLine("Bone");
}

But this one does:
xtatic void Main(string[] crgs
.:1 1st Qu.:2 1st Qu.:3 Median :1 Median Mean :1 :2 Mean :3 Qu.:3 :1 Max. :2 :3 File is V1 V2 V3 Min. :1 Min. Min. :3 1st Qu.:1 1st Qu.:2 1st Qu.:3 Median :1 Median :2 Median Mean :1 Mean :2 Mean :3 3rd Qu.:1 3rd Qu.:2 3rd Qu.:3 Max. Max. Max. ... A: You can do something like this: names(data_list) <- txt_files Or perhaps: names(data_list) <- basename(txt_files) Or use sapply instead of lapply. Q: Why moving line cause deadlock? I I am missing something obvious Why this code cause static Main(string[] args) { _lock1 = new object(); object _lock2 = new object(); Thread code1 = new Thread(() => { lock { lock Console.WriteLine("A"); Thread.Sleep(3000); } Thread = new Thread(() lock (_lock2) { lock (_lock1) { } }); code1.Start(); code2.Start(); code1.Join(); code2.Join(); Console.WriteLine("Done"); } this one static void Main(string[] args
.:1   1st Qu.:2   1st Qu.:3  
 Median :1   Median :2   MediaN :3  
 Mean   :1   Mean   :2   MEan   :3  
 3rd qu.:1   3rD Qu.:2   3Rd qu.:3  
 MaX.   :1   Max.   :2   max.   :3  
File is  f2.txt 
       V1          v2          v3   
 Min.   :1   min.   :2   Min.   :3  
 1st Qu.:1   1st Qu.:2   1st Qu.:3  
 MediAn :1   MedIaN :2   mediAN :3  
 MEan   :1   MeAn   :2   Mean   :3  
 3rD qu.:1   3RD qu.:2   3rD QU.:3  
 MAx.   :1   MAx.   :2   mAx.   :3  
...

[Etc]

A:

YOu cAn do somEthing like ThiS: 
nAmes(data_list) <- TXt_Files

Or perHapS: 
names(data_liSt) <- bAsenamE(tXt_fILes)

Or MayBe use Sapply INstead Of lapply. 

 Q:

whY Moving THis line CAUsE deaDlock?

I think I am misSInG Something obvioUs here:
whY DoES ThiS coDe doesn't caUsE deadLOck:
statIC vOID maiN(String[] args)
{
    objEct _lock1 = new oBJecT();
    objecT _lOck2 = NEw objeCt();

    ThrEaD CodE1 = new Thread(() =>
    {
        lOck (_lOck1)
        {
            lock (_loCk2)
            {
                ConsOLe.WritelIne("A");
                ThrEad.SleEp(3000);
            }
        }
    });

    THreAd coDE2 = nEw thrEaD(() =>
    {
        LocK (_LoCk2)
        {
            lOCk (_lOck1)
            {
                ConsoLe.wrIteLiNe("B");
                THREAD.SleEp(3000);
            }
        }
    });

    cOde1.STart();
    cOde2.Start();

    code1.JOin();
    Code2.jOin();

    consoLe.WriTeLiNe("done");
}

BUt this One doEs:
Static void Main(sTrinG[] args
.:1   1st Qu.:2   1st Qu.: 3  
 Media n :1  M edi an  :2  Me dian :3  
 Mea n    : 1   Mean   :2   Mean  :3 
3 rd Q u .: 1   3 rd Qu.: 2  3 rdQu .: 3 
M ax .   : 1  Max.  :2   Max.   :3   
File is f 2. txt 
      V 1          V 2       V3 
 Mi n.  :1  Min.   :2  Min.   : 3
 1stQ u.:1  1 s tQu.: 2   1st Qu.:3  
M ed i an :1   Median  :2  Me d ia n :3 
Mean   :1 Mean :2   M e an :3
 3rd Qu.:1  3rd Qu.:2 3r d Qu.: 3 
M ax.  :1  Ma x .  :2   Max.  :3   
...

[ etc]
A :

Youc an do s omethi nglik e th i s:  nam es ( dat a _l ist )  <-  txt_fil es 
Or pe rhap s : name s(d ata_ list)  <- basename( txt _fil e s)
Or m aybeusesa pplyinstea d ofla pply. 

 Q:

Wh y mo ving this  li ne  ca us e dea d lock?
Ithi nk I am  missin g  so me t h i ng  obvious here:
Why  d o e sthis cod e does n 't  c a use dead lo ck: 
sta t i c voi d Ma i n( string[]  args) {   objec t_lock1  =  ne w o bject ( );
   obj ect _loc k2 =n ew object();
   Thread cod e 1= ne w  Thr ead (() =>
   {
     loc k  ( _lo c k1)
     { 
          lock (_lo ck 2)
          {
               C o n s ole.Writ eLin e (" A ");
              Thread.Sl e ep(3000) ;
          }
     }
    }) ;
   Th rea d co de2 = new Thr e a d(()  = >
    { 
       l ock  (_ loc k2) 
       {         lo ck  (_ lock1 ) 
         {            Cons ole. Wr it e Lin e("B");          Thr ea d.Sle ep(3 0 00) ;
           }     }   });
    code1.Sta rt ();
    co de 2.S tart() ; 
    cod e1.Join();
    code2.Jo i n();

  Conso le.W riteLine( "Do ne");}
B ut thi s onedoes: 
s tat i c  void M ai n(s tr ing[] args 
.:1 _ 1st_Qu.:2   1st_Qu.:3 _
_Median :1__ Median :2_  Median_:3  
 Mean_  :1__ Mean   :2   Mean   :3  
 3rd_Qu.:1_ _3rd_Qu.:2_  3rd Qu.:3 _
 Max.   :1_ _Max.   :2   Max. __:3  
File_is  f2.txt 
     _ V1    _  ___V2   _     _V3   
 Min. _ :1   Min.  _:2   Min.  _:3  
 1st Qu.:1_ _1st Qu.:2   1st_Qu.:3  
_Median :1_  Median_:2   Median :3 _
 Mean _ :1   Mean __:2  _Mean__ :3_ 
 3rd_Qu.:1_ _3rd_Qu.:2   3rd Qu.:3 _
_Max.   :1   Max._  :2 __Max.   :3_ 
...

[etc]

A:

You can do something_like this: 
names(data_list) <- txt_files

Or perhaps:_
names(data_list) <-_basename(txt_files)

Or maybe_use sapply instead of lapply. 

 Q:

Why moving this line cause_deadlock?

I think I am missing something_obvious here:
Why does this_code doesn't_cause_deadlock:
static void Main(string[]_args)
{
_ _ object _lock1 = new object();
 _ _object _lock2 = new object();

 _  Thread code1_=_new Thread(() =>
   _{
     _  lock (_lock1)
 ___    {
_     _  _  lock (_lock2)
   __     __{
     ___    _   Console.WriteLine("A");
  _        _  _ Thread.Sleep(3000);
   ___      }
   _ _  }
_   });

    Thread code2 =_new Thread(() =>
    {
_       lock (_lock2)
  _     {
  _      _  lock (_lock1)
__      ____{
  _  _  _ _  _ _Console.WriteLine("B");
  __            Thread.Sleep(3000);
     _     _}
    __  }
_   });

_   code1.Start();
    code2.Start();

_   code1.Join();
    code2.Join();

 __ Console.WriteLine("Done");
}

But_this one does:
static void_Main(string[] args