Variable name restrictions in R

You might be looking for the discussion from ?make.names: A syntactically valid name consists of letters, numbers and the dot or underline characters and starts with a letter or the dot not followed by a number. Names such as “.2way” are not valid, and neither are the reserved words. In the help file itself, there’s … Read more

duplicate ‘row.names’ are not allowed error

Then tell read.table not to use row.names: systems <- read.table(“http://getfile.pl?test.csv”, header=TRUE, sep=”,”, row.names=NULL) and now your rows will simply be numbered. Also look at read.csv which is a wrapper for read.table which already sets the sep=’,’ and header=TRUE arguments so that your call simplifies to systems <- read.csv(“http://getfile.pl?test.csv”, row.names=NULL)

How should I deal with “‘someFunction’ is not an exported object from ‘namespace:somePackage'” error? [closed]

Some reasons: Function is not part of the package, anymore, try ??someFunction to find out which package it belongs to. Package data is not part of the package Function is available in newer version of the package, reinstall latest version. See also these questions referring to specific instances of this problem: Error: ‘use_package’ is not … Read more

R round to nearest .5 or .1

Probably, round(a/b)*b will do the work. > a <- seq(.1,1,.13) > b <- c(.1,.1,.1,.2,.3,.3,.7) > data.frame(a, b, out = round(a/b)*b) a b out 1 0.10 0.1 0.1 2 0.23 0.1 0.2 3 0.36 0.1 0.4 4 0.49 0.2 0.4 5 0.62 0.3 0.6 6 0.75 0.3 0.6 7 0.88 0.7 0.7