
Installing WaveThresh3 for R in Windows
The following assumes that you have already installed R for Windows.
(If not and you want to install R for Windows, click here)
Currently there is no proper R package for WaveThresh3. However,
it is possible to use the WaveThresh3 software in R in Windows
by following the following instructions.
- First create a folder somewhere for the distribution. (e.g.
using Windows explorer)
- Then download the following zip file and save it to the folder you
just created.
WaveThreshRwin.zip
Currently, this is version 3.9.9.
In some browsers you can do this easily by
right-clicking on the link and choosing save, then run a program like
WinZip to extract the files. Other browsers
automatically send the file to an unzipping program. This is
ok, but make sure you save the contained files to the folder
you created.
Either way you should have extracted two files
"WT.dll" and "WaveThreshSource.Rdata")
- Find the R icon on your desktop. Copy it. Paste it into the folder
you created above.
- Open the properties for the new R file/icon in the folder (right click
on the file/icon and select "Properties"). In the "Start In" panel
enter the full path name of the folder that you created. You must
get this right! If there are any spaces in the directory names in
the path then enclose the whole directory in quotes.
- Start R by double-clicking on the R icon/file in the folder (later,
you can make a desktop shortcut if you like for this icon).
- Load the WaveThresh functions and data into R by typing:
load("WaveThreshSource.Rdata")
- Splus has a function called
tspar
that R does not have (for a good
reason). However, create it here to make it easy for WaveThresh to work. Type:
tspar <- function(x)
attr(x, "tspar")
- Load the C program code into R by typing:
dyn.load("WT.dll")
That's it!!
Now, I'm sure you'd love to play with it! Try out the following two toy examples!
Do the discrete wavelet transform of the sequence 1,2,3,4,5,6,7,8 using Daubechies
least-asymmetric wavelets and see what is at level 2:
tmp <- wd(1:8)
accessD(tmp, level=2)
you should see the numbers
[1] -2.86767197 0.43395964 0.05261817 -0.44733296
Now, how about a non-decimated wavelet transform in packet order! Let's use Daubechies'
extremal phase wavelets N=5:
tmp2 <- wst(1:8, filter.number=5, family="DaubExPhase")
accessD(tmp2, level=2)
You should see the numbers
[1] -3.5498150 1.1372281 -0.5431721 0.1273318 2.2446533 -0.8011310 0.0773999
[8] 1.3075050
You can access the help on WaveThresh3 HERE
Note that WaveThresh3 has not been extensively tested in R. I would appreciate bug reports.
Please send to:
wavethresh-software@bristol.ac.uk
Bug fixes
- 19th September 2003
- Bugfix in the C function CScalFn fixed. The only R function that uses this (I think)
is ScalingFunction which is called again only by (I think) draw.default. Thanks to
Barry Rawlinson and Sundar Dorai-Raj for sorting out the bug and thanks to
David Harte for pointing it out.
Installing R for Windows
To install R for Windows follow these instructions:
- Go to the R home page
- Then select "Mirrors", then choose the location nearest to you (e.g.
I selected "Bristol").
- Then click on "R Binaries"
- Then "windows"
- Then "base" and there is a helpful web page.
- I then generally save and execute
the peculiarly named rw1061.exe file (although 1061 will increase as new
versions come out).
- If you intend on installing WaveThresh according to the instructions above
then I would recommend that you say "Yes" to the question asking you whether
you would like a desktop icon.