Note that there are some explanatory texts on larger screens.

plurals
  1. POLoop over different subdirectories
    primarykey
    data
    text
    <p>I'm new to R and so not very familiar to even simple functions yet. Short description of my attempt: I got one direktory with several subdirectories (11 subdirectories, as seen in the code below ). Each of this subdir. has got the same struckture. Each of this subdir. contains four .csv-files, called gwn,rh,ro and rg1. I want to read each of the gwn.csv one by one and write parts of it to another file, that has been created in my main morking folder. </p> <p>Thats my last try:</p> <pre><code>files&lt;-list.files("../Tagessummen") </code></pre> <p>That gives me the structure of the direktory that looks like:</p> <pre><code>[1] "Beobachtet" "Projektion_00" "Projektion_11" [4] "Projektion_22" "Projektion_33" "Projektion_44" [7] "Projektion_55" "Projektion_66" "Projektion_77" [10] "Projektion_88" "Projektion_99" </code></pre> <p>Now i thougt i could use this for defining the loop-path. I tried with this:</p> <pre><code>for(i in 1:length(files)) Grundwasserneubildung_Daten&lt;-read.table('../Tagessummen/',files,'/zeit.dat/Tag/geb_sum.gwn') Grundwasserneubildung_Daten&lt;-Grundwasserneubildung_Daten[-1,-1] Grundwasserneubildung&lt;-cbind(Grundwasserneubildung,Grundwasserneubildung_Daten) end </code></pre> <p>But it does not work. I think, it has something to do with the definition of the loop. I did read lots of similar questions, but nothig worked so far.</p> <p>2nd questions wolud be, how to implement another loop, to read and work with the other three files in the same'one-by-one'-manner. Hope you got some enlightening answer for me.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload