Adam Rountrey | 2 Apr 04:03 2015
Picon

Windows serial connection

Using Windows 8.1

I have an Arduino connected and I am trying to read from and write to a
serial connection using R.  The problem involves the reading.  I am able to
establish the connection using the following:

> system("mode COM4 baud=9600 parity=n data=8", show.output.on.console=T)
> a = file("COM4", open="r+",encoding="UTF8", blocking=F)

I am able to write to the connection using:

> writeOne = function(x){
>    cat(paste(x, "\n", sep=""), file = a)
> }
> writeOne("test")

I am able to read from the connection using:

b = readLines(a,n=1)

However, if I read the last line in the COM4 buffer, and the Arduino later
writes more to the buffer, I am unable to read it.  I only get
"character(0)".  The Arduino seems to be behaving okay, as I can read an
write using the Arduino Serial Monitor.  If after reaching this point, I
close the connection and open it again, I am able to read from COM4 again
(until I read a final value again).  Any ideas as to what might be going
one here?

Many thanks for any ideas.

(Continue reading)

marion howard | 1 Apr 23:04 2015
Picon

Error in dis[sppInSample,sppInSample]:subscript out of bounds

Hello,
I am new to R and am encountering an error message that I cannot find a solution for.
I am attempting to calculate MPD (mean pairwise distance), without weighting for abundance, with a
community species list and a phylogenetic tree in newick format with branch lengths.
I have read in both list and tree .txt files and calculated PD without any problem.
To calculate MPD I have entered:>MPD1=mpd(list,cophenetic(tree))
Error:Error in dis[sppInSample, sppInSample] : subscript out of bounds
Thank you for you helpCheersMarion. 		 	   		  
	[[alternative HTML version deleted]]

Highland Statistics Ltd | 1 Apr 23:46 2015

2 statistics courses in Perth

Apologies for cross-posting

We would like to announce the following 2 statistics courses in Perth, 
Australia.

Course1:  Data exploration, regression, GLM & GAM with introduction to R
Location: UWA, Perth, Australia
Date:       20-24 July 2015
Price:       500 GBP
Course website: http://www.highstat.com/statscourse.htm
Course flyer: 
http://www.highstat.com/Courses/Flyers/Flyer2015_07Perth_regression_GLM_GAM.pdf

Course2:  Introduction to Linear mixed effects models,  GLMM and MCMC with R
Location: UWA, Perth, Australia
Date:       27-31 July 2015
Price:       500 GBP
Course website: http://www.highstat.com/statscourse.htm
Course flyer: 
http://www.highstat.com/Courses/Flyers/Flyer2015_07Perth_GLMM.pdf

Kind regards,

Alain Zuur

--

-- 
Dr. Alain F. Zuur

First author of:
1. Beginner's Guide to GAMM with R (2014).
(Continue reading)

Collin Lynch | 1 Apr 22:54 2015
Picon

Kruskal-Wallace power tests.

Greetings, I am working on a project where we are applying the
Kruskal-Wallace test to some factor data to evaluate their correlation with
existing grade data.  I know that the grade data is nonnormal therefore we
cannot rely on ANOVA or a similar parametric test.  What I would like to
find is a mechanism for making power calculations for the KW test given the
nonparametric assumptions.  My perusal of the literature has suggested that
a simulation would be the best method.

Can anyone point me to good examples of such simulations for KW in R?  And
does anyone have a favourite package for generating simulated data or
conducting such tests?

    Thank you,
    Collin.

	[[alternative HTML version deleted]]

Alaios via R-help | 1 Apr 16:14 2015

change language at console

Hi all,I am a linux R user and my default R environemnt (after writing R in linux console) returns the error
messages in German (I am not the system adminitstrator and I can not change system settings). I know that
the English package is also installed so I guess I need to set some environmental variable for this.Any
idea how I am doing that?
RegardsAlex

	[[alternative HTML version deleted]]

Alaios via R-help | 1 Apr 12:34 2015

From replicate to accesing sublists

Dear all,I have a R structure that was created with replicate.The data sets looks to be a matrix with each
cell being a list.
str(error_suburban_0[,1],max.level=1)
List of 4
 $ vaR      :List of 20
  ..- attr(*, "class")= chr "variogram"
 $ Shadowing:List of 2
  ..- attr(*, "class")= chr "geodata"
 $ FIT      :List of 1
 $ propmodel:List of 12
  ..- attr(*, "class")= chr "lm"

The error_suburban is a matrix that each field so 
error_suburban_0[,1], error_suburban_0[,2], error_suburban_0[,3], error_suburban_0[,4],... and
so on,  contains the four sublists
$ vaR      :List of 20
  ..- attr(*, "class")= chr "variogram"
 $ Shadowing:List of 2
  ..- attr(*, "class")= chr "geodata"
 $ FIT      :List of 1
 $ propmodel:List of 12
  ..- attr(*, "class")= chr "lm"

I would like to pick for each of these matrix elements to collect only the $Shadowing sublist
error_suburban_0[,1], error_suburban_0[,2], error_suburban_0[,3], error_suburban_0[,4]... and
so on

Right now I am implementing this by a for loop that access each matrix element sequentially.

Can you please advice me if there is a better approach to do that in R?
(Continue reading)

Thomas | 1 Apr 10:52 2015
Picon

read.table with a "memory connection"

Hi,

Is there a way to create "memory connections" in R which are valid 
connections to read.table (and associated function)? By saying "memory 
connection" I refer to something like a connection created from a simple 
character object (of length 1) - instead of having the content in a 
physical file just have it in an ordinary R object. More or less the 
equivalent to the std::istringstream class in C++.

thanks,
Thomas

Fix Ace | 1 Apr 07:28 2015
Picon

about model.matrix

I tried to run the sample code from R:
dd <- data.frame(a = gl(3,4), b = gl(4,1,12))   a b
1  1 1
2  1 2
3  1 3
4  1 4
5  2 1
6  2 2
7  2 3
8  2 4
9  3 1
10 3 2
11 3 3
12 3 4
options("contrasts")
model.matrix(~ a + b, dd)(Intercept) a2 a3 b2 b3 b4
1            1  0  0  0  0  0
2            1  0  0  1  0  0
3            1  0  0  0  1  0
4            1  0  0  0  0  1
5            1  1  0  0  0  0
6            1  1  0  1  0  0
7            1  1  0  0  1  0
8            1  1  0  0  0  1
9            1  0  1  0  0  0
10           1  0  1  1  0  0
11           1  0  1  0  1  0
12           1  0  1  0  0  1
when I tried to remove the intercept from the matrix, I used the following codemodel.matrix(~ 0+a + b, dd)
 a1 a2 a3 b2 b3 b41 1 0 0 0 0 02 1 0 0 1 0 03 1 0 0 0 1 04 1 0 0 0 0 15 0 1 0 0 0 06 0 1 0 1 0 07 0 1 0 0 1 08 0 1 0  0 0 19 0 0 1 0 0 010 0 0 1 1 0 011 0 0 1 0 1
(Continue reading)

Luis Fernando García | 1 Apr 05:41 2015
Picon

Edit plot adehabitatHS

Dear R experts,

I am making a selectivity analysis using the  package. Nevertheless, I am
having some troubles, and I would like to know if somebody know how to help
me:

1) When changing the x-axis labels. The programm uses the name habitat
instead of the names specified in the file.

2) Is it possible to edit this plot, #3 (bottom-left), for example is it
possible to change the symbols style, the legend position or size? I do not
know how to edit this kind of data, if somebody has an example using this
package, I would really appreaciate it.

Thanks!!

Please find attached the plot, the script and the respective plot

library(adehabitatHS)
pse<-read.table("pseudos.txt", header=T)

attach(pse)
names(pse)
head(pse)
(wiRatio <- widesI(Diet, Dis))
png(filename = "plotpseudos3.png", width = 500, height = 500)
opar <- par(mfrow=c(2,2))
plot(wiRatio)

par(opar)
(Continue reading)

im db | 31 Mar 23:26 2015
Picon

Calculating different PCAs in R

Dear All, I want to use princomp() function in R in order to calculate Principle Component Analysis.In
different papers, I have seen "PCA 1", "PCA 2", "PCA 11" , etc. Would you please tell me how can i calculate
different PCAs in R?At the moment i just use this line "eigenVectors <- pca$loadings"But I don’t know if
it is correct to use loadings.Thank you in advance.  Best regards,
Iman Dabbaghi

	[[alternative HTML version deleted]]

______________________________________________
R-help <at> r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
T.Riedle | 31 Mar 22:47 2015
Picon

Using matlab code in R

Hi everybody,
I have a matlab code which I would like to use for my empirical analysis. Unfortunately, I am not familiar
with matlab and it would be great if there was a tool to "translate" the matlab code into R so that I can work
with the code in R.
Is there such a tool or package in R?

Kind regards,
T.

	[[alternative HTML version deleted]]


Gmane