Blog

  • My R Cheat Sheet

    This is going to be grossly insufficient for anyone trying to learn R (a wonderfully powerful statistical package … although the “stats” part of that may be my inner statistician). This is merely a set of commands I tend to use myself on the rather too rare occasions when I need R.

    R is started with “R” at the command-line … of course (although “r” does something quite different).

    Loading Data

    If you have a file formatted like :-

    number1 number2
    number3 number4

    Then this can be read into a “variable” with :-

    > Data <- read.table("filename.dat")

    If it is convenient to add column names into the file to give presentable names later on, then do so and tell R that there are headers :-

    > Data <- read.table("filename.dat", header=TRUE)

    Whilst R has plenty of control about how to read data … far more than I need at least, it may be easiest to munge your input data into the above format if you are more comfortable with the command-line. You can see how R has imported your data with :-

    > names(Data)
    [1]: "header1" "header2"

    Later when it comes to doing something with the actual data, you can access the relevant “vector” with Data$header1. But hopefully you will choose more meaningful names!

    Stats Summary

    To produce a summary of a vector :-

    > summary(vector)
       Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
       1249    6938   18900   16210   24100   30840

    Graphs

    This section needs a lot of expansion. But to graph two variables … essentially one being a value at a particular time and the other being the time :-

    plot(v1, v2, xlab="Horizontal label", ylab="Vertical label", main="Title")

    This will draw the graph onto the default device – which is normally the main X11 display. If you want to change the output, you need to choose an alternate device. For a PNG file :-

    png("filename.png")
    (Redo the plot you're happy with)
    dev.off()
  • Windows: Turning Off IPv6

    This is a note for my own future sanity (like when I start using IPv6 and want this enabled again) given that this information is widely available around the network. If you do not know why you would want to turn off IPv6 when you are almost certainly not using it, then you probably want to do it anyway.

    Hint: You may have a globally reachable IPv6 address on your machine that bypasses your firewall. And if that doesn’t worry you, it should!

    Anyway, to turn it off run regedit in your preferred manner, and create the following DWORD attribute :-

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\tcpip6\Parameters\DisabledComponents

    Set the value to FF (in hexadecimal). And reboot your machine.

    So far this has worked with :-

    1. Windows Server 2008R2
    2. Windows 7 (Ultimate)
  • Do The Tories Want To Privatise Universities ?

    Today a Tory let slip that some in the Tory party may be thinking of letting Universities supplement their income by offering additional places over the current quota to UK students which would be charged at the same rate as non-EU students. Of course they very rapidly back-pedalled from this position, but was it a slip or something that the Tories are planning … in a year or five ?

    First of all, a little background. UK Universities are free to charge non-EU students pretty much what they want to within the constraints of supply and demand – pretty much like a business. This can be pretty lucrative for many Universities, and there is a fairly active pursuit of foreign students.

    There are benefits and disadvantages to this of course. Foreign students may not always have the best possible English language skills which can conceivably have a detrimental effect on teaching. However offering a limited number of places to foreign students does have advantages that counter this – first of all exposing “native” students to foreign students widens the experience of both groups, and recruiting foreign students adds to the possible pool of expertise to hire the best researchers from.

    But allowing Universities to recruit UK students on the same fees as non-EU students ? Well it might sound ok – allow the Universities to recruit students from anywhere to supplement their quota of UK students, but it is an obviously slippery slope from that. Over time the Tories could slowly cut the student quota and leave UK students with eventually little choice other than to pay the “full price” with no support for their education.

    Of course the Tories claim that there are no such plans, but do we believe them ?

  • Super Injunctions, Twitter, and Old Media

    Today there is a lot of fuss about the information on just who has obtained a super injunction to prevent the publication of details of their sordid private life being “published” via a Twitter post. It is probable that the relevant Twitter post is just wrong, but more interesting than that is the reaction of the old media. And an apparent misunderstanding of just what Twitter is.

    The old media is complaining that there is effectively two rules – one for them and a quite different one for Twitter users. Well, no it isn’t quite like that. The relevant Twitter user – if he or she is within the jurisdiction of a UK court – is just as guilty of breaching the injunction as an old media company who published the story themselves. In practice, it is not possible to stop a Twitter user publishing before being prevented from doing so – there are just too many Twitter users out there from stopping them.

    What will be the effect of this in the medium term? Basically it means that the old media will not be able to make any money at the old meaningless “three people in a bed” story – they will still be able to sell newspapers with real news, but meaningless exposés of someone’s private life with no real public interest will be a lot less likely. With any luck. And good. The news is not made any better by knowing that celebrity X slept with gold-digger Y unless that celebrity is genuinely in public life and making a moral stand on such issues.

    The funny thing is that people somehow think that this is a new “problem”. I can remember the Spycatcher issue way back in the day where a publisher was prohibited from publishing the autobiography of a former MI5 agent in England, but the book was widely available elsewhere in the world (including unbelievably in Scotland!). Although the mechanisms were different, the basics are the same – one group of people are not allowed to tell the story, but another are.

    Now onto the misunderstanding of Twitter itself. When someone “tweets” some item of news on Twitter, the company itself is not responsible – except to the extent that they are obligated to take it down given appropriate legal action. The person responsible for the content of the tweet is the tweeter themselves. The Twitter company themselves are no more responsible for the content than the newspaper delivery boy is responsible for what is in the newspaper.

    Having said that, I believe that super injunctions are wrong. Injunctions to stop a story being published are all very fine, although they are relatively unobtainable for an ordinary person. And yes ordinary people do sometimes appear in news stories. But preventing the fact of an injunction stopping a story being published is wrong.

  • To The Eastern Road

    Some pictures from the “other side” of Portsmouth this time :-

    Old Metal 1, 2, &3

    Old Metal 1
    Old Metal 2
    Old Metal 3

    And something a little more accessible :-

    Sailing

    Sailing

    Dog Inspects Memorial

    Dog Inspects Memorial