Kubke Lab:Research/ABR/Notebook/2013/10/28

From OpenWetWare
Jump to navigationJump to search
Hearing development in barn owls <html><img src="/images/9/94/Report.png" border="0" /></html> Main project page
<html><img src="/images/c/c3/Resultset_previous.png" border="0" /></html>Previous entry<html>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</html>Next entry<html><img src="/images/5/5c/Resultset_next.png" border="0" /></html>

General Entries

  • Insert content here...

Personal Entries

Fabiana

  • Enter content here

<html> <head>



</head>

<body> <p>#libraries</p>

<p>#test setting directory and set to analysis file</p>

<pre><code class="r">rootdir &lt;- getwd() basedir &lt;- paste(rootdir, &quot;Dropbox/OrisABR/Sandbox&quot;, sep = &quot;/&quot;) setwd(basedir) </code></pre>

<pre><code>## Error: cannot change working directory </code></pre>

<pre><code class="r">getwd() </code></pre>

<pre><code>## [1] &quot;/Users/mkub003/Dropbox/OrisABR/Sandbox&quot; </code></pre>

<p>#Get info from the text file</p>

<pre><code class="r">metadata &lt;- readLines(&quot;Copy224l0a.txt&quot;) n = length(metadata) print(metadata[1:n]) </code></pre>

<pre><code>## [1] &quot;MOUSEABR version 6.00&quot;

    1. [2] &quot;Date: 10/07/97&quot;
    2. [3] &quot;Time: 21:35:23&quot;
    3. [4] &quot;Comment: D=9700 Tek 5+ Lux-46 Loud Norm&quot;
    4. [5] &quot;Stimulus was 1 cycles of 5000 Hz at interval of 1000 msec&quot;
    5. [6] &quot;delay-0: 0 usec delay-1: 60 usec delay-2: 400 usec &quot;
    6. [7] &quot;Number of repetitions: 30&quot;
    7. [8] &quot;Sample Clock Rate: 50000 Hz&quot;

</code></pre>

<p>#read data file and pass it to a new file so I can modify without loosing the

  1. original file. Tried write.csv but it adds a number column to the left -
  2. write table copies without adding a 6th variable</p>

<pre><code class="r">mydata &lt;- read.table(&quot;Copy233L0B.ABR.txt&quot;, header = T) head(mydata) #passed test </code></pre>

<pre><code>## msec left right spont bin

    1. 1 0.00 1000 1000 1000 1000
    2. 2 0.02 1000 1000 1000 1000
    3. 3 0.04 1000 1000 1000 1000
    4. 4 0.06 1000 1000 1000 1000
    5. 5 0.08 1000 1000 1000 1000
    6. 6 0.10 1000 1000 1000 1000

</code></pre>

<pre><code class="r">write.table(mydata, &quot;mydata_new&quot;) mydata_new &lt;- read.table(&quot;mydata_new&quot;, header = T) head(mydata_new) #passed test </code></pre>

<pre><code>## msec left right spont bin

    1. 1 0.00 1000 1000 1000 1000
    2. 2 0.02 1000 1000 1000 1000
    3. 3 0.04 1000 1000 1000 1000
    4. 4 0.06 1000 1000 1000 1000
    5. 5 0.08 1000 1000 1000 1000
    6. 6 0.10 1000 1000 1000 1000

</code></pre>

<p>#Plot the 4 variables (left, right, spont and bin)</p>

<pre><code class="r">par(mfrow = c(2, 2)) #puts the 4 graphs in a page plot(mydata_new[c(1, 2)], type = &quot;l&quot;) plot(mydata_new[c(1, 3)], type = &quot;l&quot;) plot(mydata_new[c(1, 4)], type = &quot;l&quot;) plot(mydata_new[c(1, 5)], type = &quot;l&quot;) </code></pre> </html>

Andy

  • Enter content here

Oris

  • Enter content here