Category Archives: Data Science

R’s annoying slash problem on windows – a quick and dirty solution…

R’s annoying slash problem on windows – a quick and dirty solution…

R on windows uses a Unix (/) rather than a MS-DOS (\) slash which makes copying paths etc a problem. I have a quick and dirty solution that uses a simple dos program to do the conversion and then put the result on the clipboard. The only minor annoyance with this approach is that it momentarily flashes a dos box up while the app executes but it seems a small price to pay to avoid messing about with com and shell extensions.

To Use
Create a registry Key in [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\Copy Path Unix Format]
and a registry entry in [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\Copy Path Unix Format\Command] @="*PUT_PATH_HERE*\UnixDirectoryFormatting.exe \"%1\""

After this Your Registry tree Will look like this
SOFTWARE |->Classes |->* |->shell |->Copy Path Unix Format |-> Command
and in command you will have a single key (Default) of type REG_SZ with data ?:...\UnixDirectoryFormatting.exe "%1"

Now if you right click any file in windows explorer you will see the Copy Path Unix Format menu.

The Git hub code for this is here… or if you would prefer the compiled code it is here as a zip file…

Invalid (NULL) left side of Assignment in R

I was trying to compile a function in R and came across this error

loadchar() <- function( path, filename){ …

}

Error in loadchar() <- function(path, filename) { :
invalid (NULL) left side of assignment

I couldn’t find much on the internet but the answer (in my case at least)  was simple…

The issue is the brackets in the function name ie it should be

loadchar <- function( path, filename){ …

}

an easy mistake to make … especially if you are jumping between languages regularly