[R] use table function with data frame subsets

2017-02-20 Thread message
Readers, Data set: 20170101,10020,A,b,Y 20170101,10020,B,b,N 20170101,10020,C,d,Y 20170102,20001,C,d,Y 20170102,20001,D,m,Y 20170102,20001,L,a,Y testtable<-read.csv('~/tmp/data.csv',header=F) testtablea<-testtable[grep('^10',testtable[,2]),] testtable V1V2 V3 V4 V5 1 20170101

[R] multiple uses ifelse function

2016-10-11 Thread message
Readers, Could someone please explain how to apply the function 'ifelse' to change a vector, for various conditions? testseq<-seq(1:20) testchange<-ifelse(testseq<=4,'x',testseq) testchange<-c(ifelse(testseq<=4,'x',testseq),ifelse(testseq>=5,'y',testseq)) The last instruction causes the

[R] multiple bar plot annotation text labelling

2016-04-04 Thread message
Readers, The attempt is to create a bar plot with text labels adjacent to each datum value. Data file: 1,3,A 1,8,B 1,1,C 1,9,D 2,5,C 2,4,E 2,2,F 2,0,G testbarplot<-read.csv('data1.csv', header=FALSE) barplot(axes=FALSE, ann=FALSE, horiz=TRUE, testbarplot[,2], ylab= 'group', xlab= '(x

[R] apply diff type function to matrix

2014-06-19 Thread message
Readers, For a matrix: 1 10 20 30 2 15 40 60 3 20 80 120 Using a spreadsheet, a differential function can be applied to the data as a formula: |(10-15)/(1-2)| ... repeated for each pair of adjacent values What is the corresponding function in R please? Is it better to write a new function, or

[R] bar plot stacked

2014-06-19 Thread message
Readers, For data set: a, 90, 10 b, 60, 40 c, , d, , 50 A plot was attempted: dataset-as.matrix(read.csv(datafile.csv,header=FALSE)) barplot-(dataset,horiz=TRUE) A warning message is returned, about NAs introduced by coercion and an undesirable graph. The desired output is something similar

Re: [R] solve scalar linear equation

2014-05-22 Thread message
On 2014-05-20 10:00, r-help-requ...@r-project.org wrote: -- Message: 32 Date: Mon, 19 May 2014 23:04:27 +0100 From: Rui Barradas ruipbarra...@sapo.pt To: message let...@openmailbox.org, r-help@r-project.org uniroot(function(x) 5*x - 55, c(0, 20)) Why does

Re: [R] solve scalar linear equation

2014-05-22 Thread message
On 2014-05-22 11:00, Berend Hasselman wrote: uniroot(function(x) 5*x - 55, c(0, 10)) Error in uniroot(function(x) 5 * x - 55, c(0, 10)) : f() values at end points not of opposite sign I don’t believe this. The error message says it all. 5*0-55 == -55 5*10-55 == -5 The error states

[R] manual installation errors; install.package, R CMD

2014-05-22 Thread message
of a repository? Sometimes, a dependent package is reported as being un-available, e.g.: install.packages(mclust) Warning message: In getDependencies(pkgs, dependencies, available, lib) : package ‘mclust’ is not available Alternatively, tried the command 'R CMD': R CMD INSTALL http://cran.r

Re: [R] manual installation errors; install.package, R CMD

2014-05-22 Thread message
On 2014-05-22 13:08, Sarah Goslee wrote: It's possible that a package is not available for your OS or version of R, but you don't tell us either. For the record, GNU/Linux R2110 That FAQ doesn't say that R is capable of downloading it for you: you need to download the package manually,

[R] solve scalar linear equation

2014-05-19 Thread message
Readers, The function 'solve' states that it is applicable to a vector or matrix object. Please what is the syntax to solve a very simple equation like: 5x + 1 = 56 The books read so far give explanations for simultaneous linear equations or differential equations, but there have not been