I'm making PSD plots of one minute recordings of white noise that I made underwater with a hydrophone. I have about 12 files to analyze. I made the plots, but my professor wants me to do a log transform of the data and make a plot of that. I am new to R and am not sure how I would go about doing this. Any help is appreciated.
Asked
Active
Viewed 404 times
0
-
Welcome to Stack Overflow. Any more information is also useful. What have you tried so far? Right now it might be taken as you want us to write the code for you. Which isn't what this site is for. – Emz Aug 03 '15 at 19:36
1 Answers
1
If you already know how to make the plots (sounds like you do since you've already created them), you can either log transform the data directly using either transformed_x <- log(x)
for the natural logarithm or transformed_x <- log10(x)
for the common logarithm. Once you have your newly transformed variable you can just insert that into your existing code.
If you are using plot() you can add an additional argument plot(x ~ y, main=, xlab=, ylab=, log="y")
or log ="x"
or log="xy"
depending on which variables you want transformed in your graph. The nice thing about this second option is that it doesn't alter the underlying data .

scribbles
- 4,089
- 7
- 22
- 29