Re: [R] Error Message using xyplot of lattice

2014-04-06 Thread arun
Hi,
You didn't provide a reproducible example.  If your dataset is something like 
this:
set.seed(495)
DataSeries - data.frame(Date=seq(as.Date(2001-01-01),by=1 day, 
length.out=20), A= sample(10,20,replace=TRUE), B= rnorm(20))


###Using your codes:

Matrix_New1 - 
cbind(as.list(DataSeries[,Date]),as.list(DataSeries[,A]),colnames(DataSeries)[2])

Matrix_New2 - 
cbind(as.list(DataSeries[,Date]),as.list(DataSeries[,B]),colnames(DataSeries)[3])

str(Matrix_New1)
#List of 60
str(Matrix_New2) 

#List of 60 

Matrix_Complete- rbind(Matrix_New1,Matrix_New2)
str(Matrix_Complete)
#List of 120
Col_Names_MC-c(X,Y, Z)
colnames(Matrix_Complete)-Col_Names_MC 

library(lattice) 

Plot_AB-xyplot(Y~ X, data =Matrix_Complete, type =c(l), groups=Z, 
as.table=TRUE, main=Development over time)
#Error in eval(expr, envir, enclos) : object 'Z' not found 

#You could try:
library(reshape2)
 DataSeriesM - setNames(melt(DataSeries,id.var=Date),LETTERS[c(24,26,25)])
 xyplot(Y~X,data=DataSeriesM,type=l,groups=Z,as.table=TRUE,main=Development 
over time)
 #for a numeric X axis
 
xyplot(Y~as.numeric(X),data=DataSeriesM,type=l,groups=Z,as.table=TRUE,main=Development
 over time) 
# with legends
 
xyplot(Y~as.numeric(X),xlab=X,data=DataSeriesM,type=l,groups=Z,as.table=TRUE,main=Development
 over time,auto.key=list(x=.85, y=.95, border=TRUE,lines=TRUE)) 


Hope it helps.

A.K.


Hi everbody, I have the following error message occuring when I run my code:
Error in eval(expr, envir, enclos) : object 'Series' not found The code I am 
using is the following: Matrix_New1 - 
cbind(as.list(DataSeries[,Date]),as.list(DataSeries[,A]),colnames(DataSeries)[2]
 )
Matrix_New2 - 
cbind(as.list(DataSeries[,Date]),as.list(DataSeries[,B]),colnames(DataSeries)[3]
 ) #whereas first and second columns should be numbers, third column is A and 
B respectively Matrix_Complete- rbind(Matrix_New1,Matrix_New2) 
Col_Names_MC-c(X,Y, Z)
colnames(Matrix_Complete)-Col_Names_MC Plot_AB-xyplot(Y~ X, data 
=Matrix_Complete, type =c(l), groups=Z, as.table=TRUE, main=Development over 
time) print(Plot_AB) Can you explain me why this way of creating a plot is not 
working and what I Need to Change in order to be able to plot it? 


__
R-help@r-project.org mailing list
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.


Re: [R] Survey

2014-04-06 Thread Anthony Damico
hi leandro, in case you're already familiar with ibge's pnad, you might
find these examples useful--

http://www.asdfree.com/search/label/pesquisa%20nacional%20por%20amostra%20de%20domicilios%20%28pnad%29

https://github.com/ajdamico/usgsd/tree/master/Pesquisa%20Nacional%20por%20Amostra%20de%20Domicilios

--they construct and analyze the sqlite-backed survey design that dr.
lumley is referring to



On Wed, Apr 2, 2014 at 6:58 PM, Thomas Lumley tlum...@uw.edu wrote:

 On Thu, Apr 3, 2014 at 2:37 AM, Leandro Marino 
 leandromar...@leandromarino.com.br wrote:

  Dear R-Users,
 
  I was using survey for the past years and now I am experiencing some
  problems with scripts that was working in the past.
 
  We are working with big data bases so I can't put all variables that I
 will
  use in the svydesign.
 

 This was never supposed to work.

 The variables shouldn't take up any more room in the survey design object
 than they do anywhere else, but in any case the right solution when you
 have enough memory for the variables in a given analysis but not for all
 the variables in your dataset is to use the database-backed designs and put
 the data in something like SQLite.

   -thomas

 --
 Thomas Lumley
 Professor of Biostatistics
 University of Auckland

 [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 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.


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.


Re: [R] Mistakes in date conversion for future date/time (POSIXct)

2014-04-06 Thread David McPearson
I _do_ see this error - on R 3.0.3 / Win XP
however, not on R 2.11.1 / Linux.
(Same hardware, 2 x OS, 2 x R versions)

Maybe it's peculiar to to 'doze...

datetimesequenz - seq.POSIXt(from=as.POSIXct(1960-01-01 00:00),
to=as.POSIXct(2100-01-01 00:00), by=1 hour)
levels(as.factor(strftime(datetimesequenz, format=%Y)))
[1] 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969
1970 1971 1972
 [14] 1973 1974 ...
 ...
[183] 2154 2155 2157 2158 2159 2160 2161 2162 2167

sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252   
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C  
[5] LC_TIME=English_Australia.1252

attached base packages:
[1] grDevices datasets  splines   graphics  stats tcltk utils
methods   base 

other attached packages:
[1] svSocket_0.9-55 TinnR_1.0-5 R2HTML_2.2.1Hmisc_3.12-2   
Formula_1.1-1  
[6] survival_2.37-4

loaded via a namespace (and not attached):
[1] cluster_1.14.4  fortunes_1.5-0  grid_3.0.2  lattice_0.20-23
rpart_4.1-3
[6] svMisc_0.9-69   tools_3.0.2  


Cheers,
D.

On Fri, 4 Apr 2014 14:19:09 -0700 David Winsemius dwinsem...@comcast.net
wrote

 On Apr 4, 2014, at 9:54 AM, Duncan Murdoch wrote:
 
  On 04/04/2014 10:55 AM, Winkler, Matthias wrote:
  Dear R-users,
  
  I'm working on datasets which contain data from the years 1960 to 2100
..
  I also produced a date/time-sequence in R, which showed the same mistakes
  (see example below). The mistakes occur at the same dates like in my
  datasets. It's always at the end of march. 
   datetimesequenz - seq.POSIXt(from=as.POSIXct(1960-01-01 00:00),
   to=as.POSIXct(2100-01-01 00:00), by=1 hour)
   levels(as.factor(strftime(datetimesequenz, format=%Y)))[1]
   1960 1961 1962 ...
  [181] 2152 2153 2154 2156 2157 2158 2159 2160 2161
  2166 
  Has anybody experienced the same problem and knows a workaround?
  
  I'm using R 3.0.1 under Windows 7 64bit. I also tried this with R 3.0.3,
  it showed the same problem. Thank you for your help!
  
  I don't see this in 3.1.0 beta.  Do you?
 
 I'm not seeing it on a Mac in 3.0.2 either.
 
  max(datetimesequenz)
 [1] 2100-01-01 PST
  length(datetimesequenz)
 [1] 1227241
 
  
  Duncan Murdoch
 
 David Winsemius
 Alameda, CA, USA
 
 __
 R-help@r-project.org mailing list
 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.




South Africas premier free email service - www.webmail.co.za 

Fight Crime And Corruption! http://www.anc.org.za/2014/manifesto/

__
R-help@r-project.org mailing list
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.


[R] GGPLOT Question

2014-04-06 Thread Philip Rhoades

People,

I have this script:

library(ggplot2)

df - read.table(text =  id min max
 Sp1 8.5 13.2
 Sp2 11.7 14.5
 Sp3 14.7 17.7 , header=TRUE)

ggplot(df) +
 geom_crossbar(aes(ymin = min, ymax = max, x = id, y = min),
 fill = blue, fatten = 0)

- is there some way to get geom_crossbar to print horizontally? - I 
couldn't find it . . and there doesn't seem to be a horizontal 
equivalent?


Thanks,

Phil.
--
Philip Rhoades

GPO Box 3411
Sydney NSW  2001
Australia
E-mail:  p...@pricom.com.au

__
R-help@r-project.org mailing list
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.


Re: [R] GGPLOT Question

2014-04-06 Thread stephen sefick
add +coord_flip() at the end. Does that do it?


On Sun, Apr 6, 2014 at 7:03 AM, Philip Rhoades p...@pricom.com.au wrote:

 People,

 I have this script:

 library(ggplot2)

 df - read.table(text =  id min max
  Sp1 8.5 13.2
  Sp2 11.7 14.5
  Sp3 14.7 17.7 , header=TRUE)

 ggplot(df) +
  geom_crossbar(aes(ymin = min, ymax = max, x = id, y = min),
  fill = blue, fatten = 0)

 - is there some way to get geom_crossbar to print horizontally? - I
 couldn't find it . . and there doesn't seem to be a horizontal equivalent?

 Thanks,

 Phil.
 --
 Philip Rhoades

 GPO Box 3411
 Sydney NSW  2001
 Australia
 E-mail:  p...@pricom.com.au

 __
 R-help@r-project.org mailing list
 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.




-- 
Stephen Sefick
**
Auburn University
Biological Sciences
331 Funchess Hall
Auburn, Alabama
36849
**
sas0...@auburn.edu
http://www.auburn.edu/~sas0025
**

Let's not spend our time and resources thinking about things that are so
little or so large that all they really do for us is puff us up and make us
feel like gods.  We are mammals, and have not exhausted the annoying little
problems of being mammals.

-K. Mullis

A big computer, a complex algorithm and a long time does not equal
science.

  -Robert Gentleman

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.


Re: [R] GGPLOT Question

2014-04-06 Thread Philip Rhoades

Stephen,


On 2014-04-06 22:09, stephen sefick wrote:

add +coord_flip() at the end. Does that do it?



Wow! - that was a fast response! - yes that works - thanks a lot!

Regards,

Phil.


On Sun, Apr 6, 2014 at 7:03 AM, Philip Rhoades p...@pricom.com.au 
wrote:



People,

I have this script:

library(ggplot2)

df - read.table(text =  id min max
 Sp1 8.5 13.2
 Sp2 11.7 14.5
 Sp3 14.7 17.7 , header=TRUE)

ggplot(df) +
 geom_crossbar(aes(ymin = min, ymax = max, x = id, y = min),
 fill = blue, fatten = 0)

- is there some way to get geom_crossbar to print horizontally? - I
couldn't find it . . and there doesn't seem to be a horizontal 
equivalent?


Thanks,

Phil.
--
Philip Rhoades

GPO Box 3411
Sydney NSW  2001
Australia
E-mail:  p...@pricom.com.au

__
R-help@r-project.org mailing list
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.





--
Stephen Sefick
**
Auburn University
Biological Sciences
331 Funchess Hall
Auburn, Alabama
36849
**
sas0...@auburn.edu
http://www.auburn.edu/~sas0025
**

Let's not spend our time and resources thinking about things that are 
so
little or so large that all they really do for us is puff us up and 
make us
feel like gods.  We are mammals, and have not exhausted the annoying 
little

problems of being mammals.

-K. Mullis

A big computer, a complex algorithm and a long time does not equal
science.

  -Robert Gentleman

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.


--
Philip Rhoades

GPO Box 3411
Sydney NSW  2001
Australia
E-mail:  p...@pricom.com.au

__
R-help@r-project.org mailing list
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.


Re: [R] GGPLOT Question - #2

2014-04-06 Thread Philip Rhoades

People,

OK, the last two bits of the puzzle - can I colour the bars 
independently and change the scale from linear to logarithmic?


Thanks,

Phil.


On 2014-04-06 22:23, Philip Rhoades wrote:

Stephen,


On 2014-04-06 22:09, stephen sefick wrote:

add +coord_flip() at the end. Does that do it?



Wow! - that was a fast response! - yes that works - thanks a lot!

Regards,

Phil.


On Sun, Apr 6, 2014 at 7:03 AM, Philip Rhoades p...@pricom.com.au 
wrote:



People,

I have this script:

library(ggplot2)

df - read.table(text =  id min max
 Sp1 8.5 13.2
 Sp2 11.7 14.5
 Sp3 14.7 17.7 , header=TRUE)

ggplot(df) +
 geom_crossbar(aes(ymin = min, ymax = max, x = id, y = min),
 fill = blue, fatten = 0)

- is there some way to get geom_crossbar to print horizontally? - I
couldn't find it . . and there doesn't seem to be a horizontal 
equivalent?


Thanks,

Phil.
--
Philip Rhoades

GPO Box 3411
Sydney NSW  2001
Australia
E-mail:  p...@pricom.com.au

__
R-help@r-project.org mailing list
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.





--
Stephen Sefick
**
Auburn University
Biological Sciences
331 Funchess Hall
Auburn, Alabama
36849
**
sas0...@auburn.edu
http://www.auburn.edu/~sas0025
**

Let's not spend our time and resources thinking about things that are 
so
little or so large that all they really do for us is puff us up and 
make us
feel like gods.  We are mammals, and have not exhausted the annoying 
little

problems of being mammals.

-K. Mullis

A big computer, a complex algorithm and a long time does not equal
science.

  -Robert Gentleman

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.


--
Philip Rhoades

GPO Box 3411
Sydney NSW  2001
Australia
E-mail:  p...@pricom.com.au

__
R-help@r-project.org mailing list
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.


[R] Column value comparison and colouring

2014-04-06 Thread Nico Met
Dear all,

I have a big matrix,  where I want to compare, one element of a vector with
many others and clear them.

For example:

In column sil compare elements with other columns (0.734)-1.0770 in 3rd
column, so, color them bold else color them bold red
For example:

 dput(test)
structure(list(Class = c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L), sil = c(0.734,
0.734, 0.734, 0.734, 0.734, -0.03, -0.03, -0.03), M201.1637T.1 =
c(-1.077019059,
-1.025923945, -2.025907674, -1.223001413, -1.547348898, -0.376842603,
-1.33495095, -0.486811653), M203.1794T.1 = c(-0.884899777, -0.878305283,
-1.910526051, -1.446826543, -1.950515819, -0.192865129, -1.669691644,
-0.636095942), M205.1950T.1 = c(-1.307163965, -1.022407192, -2.050283307,
-1.508604131, -1.710170605, -0.197410826, -1.547129558, -0.780189201
), M207.2107T.1 = c(-1.378614081, -0.950293267, -1.714837198,
-1.827195011, -1.629677288, -0.064343778, -1.598304259, -0.502002575
)), .Names = c(Class, sil, M201.1637T.1, M203.1794T.1,
M205.1950T.1, M207.2107T.1), class = data.frame, row.names =
c(52T_D06_19_42,
500030X_B03_19_15, 500059R_G09_19_81, 500061V_H02_13_86,
500078W_D10_6_46, 500082M_D05_18_41, 500105S_B09_15_21,
500120W_B04_19_16)

Thanks in advance

Nico

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.


[R] Any solution to have RnetCDF, ncdf or ncdf4 in R 3.1 ?

2014-04-06 Thread Marc Girondot
I just have installed the last RC of R 3.1. All is ok except for 3 
packages that I was not able to compile and they do not exist as 
precompiled package for MacOSX (Marverick):


These packages are RnetCDF, ncdf or ncdf4. For all, I get error when I 
try to install them:

install.packages(RNetCDF, type=source)

checking for nc_create in -lnetcdf... no
configure: error: netcdf library not found
ERROR: configuration failed for package ‘RNetCDF’
* removing 
‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RNetCDF’


install.packages(ncdf, type=source)

configure: error: netcdf header netcdf.h not found
ERROR: configuration failed for package ‘ncdf’
* removing 
‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/ncdf’

Warning in install.packages :
installation of package ‘ncdf’ had non-zero exit status

install.packages(ncdf4, type=source)

ERROR: configuration failed for package ‘ncdf4’
* removing 
‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/ncdf4’

Warning in install.packages :
installation of package ‘ncdf4’ had non-zero exit status

Sincerely,

Marc Girondot

__
R-help@r-project.org mailing list
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.


Re: [R] Column value comparison and colouring

2014-04-06 Thread Bert Gunter
Post in plain text, not HTML.

I would suggest that R is not Excel, and that you do not (shudder)
treat it as such. Learn R and use it sensibly.

Cheers,
Bert

Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom.
H. Gilbert Welch




On Sun, Apr 6, 2014 at 7:23 AM, Nico Met nicome...@gmail.com wrote:
 Dear all,

 I have a big matrix,  where I want to compare, one element of a vector with
 many others and clear them.

 For example:

 In column sil compare elements with other columns (0.734)-1.0770 in 3rd
 column, so, color them bold else color them bold red
 For example:

 dput(test)
 structure(list(Class = c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L), sil = c(0.734,
 0.734, 0.734, 0.734, 0.734, -0.03, -0.03, -0.03), M201.1637T.1 =
 c(-1.077019059,
 -1.025923945, -2.025907674, -1.223001413, -1.547348898, -0.376842603,
 -1.33495095, -0.486811653), M203.1794T.1 = c(-0.884899777, -0.878305283,
 -1.910526051, -1.446826543, -1.950515819, -0.192865129, -1.669691644,
 -0.636095942), M205.1950T.1 = c(-1.307163965, -1.022407192, -2.050283307,
 -1.508604131, -1.710170605, -0.197410826, -1.547129558, -0.780189201
 ), M207.2107T.1 = c(-1.378614081, -0.950293267, -1.714837198,
 -1.827195011, -1.629677288, -0.064343778, -1.598304259, -0.502002575
 )), .Names = c(Class, sil, M201.1637T.1, M203.1794T.1,
 M205.1950T.1, M207.2107T.1), class = data.frame, row.names =
 c(52T_D06_19_42,
 500030X_B03_19_15, 500059R_G09_19_81, 500061V_H02_13_86,
 500078W_D10_6_46, 500082M_D05_18_41, 500105S_B09_15_21,
 500120W_B04_19_16)

 Thanks in advance

 Nico

 [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 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.

__
R-help@r-project.org mailing list
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.


Re: [R] Any solution to have RnetCDF, ncdf or ncdf4 in R 3.1 ?

2014-04-06 Thread Pascal Oettli
Hello,

Do you have NetCDF library correctly installed (with headers)?

Regards,
Pascal

On Sun, Apr 6, 2014 at 11:26 PM, Marc Girondot marc_...@yahoo.fr wrote:
 I just have installed the last RC of R 3.1. All is ok except for 3 packages
 that I was not able to compile and they do not exist as precompiled package
 for MacOSX (Marverick):

 These packages are RnetCDF, ncdf or ncdf4. For all, I get error when I try
 to install them:
 install.packages(RNetCDF, type=source)
 
 checking for nc_create in -lnetcdf... no
 configure: error: netcdf library not found
 ERROR: configuration failed for package ‘RNetCDF’
 * removing
 ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RNetCDF’

 install.packages(ncdf, type=source)
 
 configure: error: netcdf header netcdf.h not found
 ERROR: configuration failed for package ‘ncdf’
 * removing
 ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/ncdf’
 Warning in install.packages :
 installation of package ‘ncdf’ had non-zero exit status

 install.packages(ncdf4, type=source)
 
 ERROR: configuration failed for package ‘ncdf4’
 * removing
 ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/ncdf4’
 Warning in install.packages :
 installation of package ‘ncdf4’ had non-zero exit status

 Sincerely,

 Marc Girondot

 __
 R-help@r-project.org mailing list
 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.



-- 
Pascal Oettli
Project Scientist
JAMSTEC
Yokohama, Japan

__
R-help@r-project.org mailing list
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.


Re: [R] Any solution to have RnetCDF, ncdf or ncdf4 in R 3.1 ?

2014-04-06 Thread David W. Pierce
Hi Marc,

those packages are just interfaces to the netcdf library that must already
exist on your machine. Try installing the netcdf library first, and then
installing the R package.

You will need the development version of the netcdf library installed in
order to compile the R packages. Hopefully the exact package name will be
obvious in the package manager on your system.

Regards,

--Dave



On Sun, Apr 6, 2014 at 7:26 AM, Marc Girondot marc_...@yahoo.fr wrote:

 I just have installed the last RC of R 3.1. All is ok except for 3
 packages that I was not able to compile and they do not exist as
 precompiled package for MacOSX (Marverick):

 These packages are RnetCDF, ncdf or ncdf4. For all, I get error when I try
 to install them:
 install.packages(RNetCDF, type=source)
 
 checking for nc_create in -lnetcdf... no
 configure: error: netcdf library not found
 ERROR: configuration failed for package 'RNetCDF'
 * removing '/Library/Frameworks/R.framework/Versions/3.1/
 Resources/library/RNetCDF'

 install.packages(ncdf, type=source)
 
 configure: error: netcdf header netcdf.h not found
 ERROR: configuration failed for package 'ncdf'
 * removing '/Library/Frameworks/R.framework/Versions/3.1/
 Resources/library/ncdf'
 Warning in install.packages :
 installation of package 'ncdf' had non-zero exit status

 install.packages(ncdf4, type=source)
 
 ERROR: configuration failed for package 'ncdf4'
 * removing '/Library/Frameworks/R.framework/Versions/3.1/
 Resources/library/ncdf4'
 Warning in install.packages :
 installation of package 'ncdf4' had non-zero exit status

 Sincerely,

 Marc Girondot

 __
 R-help@r-project.org mailing list
 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.




-- 
David W. Pierce
Division of Climate, Atmospheric Science, and Physical Oceanography
Scripps Institution of Oceanography, La Jolla, California, USA
(858) 534-8276 (voice)  /  (858) 534-8561 (fax)dpie...@ucsd.edu

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.


Re: [R] Column value comparison and colouring

2014-04-06 Thread Jeff Newmiller
Your question confuses me. Perhaps you are still thinking as though this were 
Excel?

You refer to a big matrix, but your dput (thank you for that) is actually a 
data frame. Data frames are a list of columns, each of which can have a 
different type.

Clear them? I think set them to NA. You later talk about coloring and 
formatting... are you printing the matrix using Markdown or LaTeX? You cannot 
color data directly in R, only upon output. Are you plotting using a heatmap?

You also mention comparing one column with multiple other columns. Regardless 
if this were Excel or not, that would be unclear. Do you want to compare sil 
with each column separately and create a whole new set of columns containing 
color names, or compare to the minimum of all columns and make a single column 
of color names for sil?

I think you need to clarify your intent a bit more before I can help.
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On April 6, 2014 7:23:56 AM PDT, Nico Met nicome...@gmail.com wrote:
Dear all,

I have a big matrix,  where I want to compare, one element of a vector
with
many others and clear them.

For example:

In column sil compare elements with other columns (0.734)-1.0770 in
3rd
column, so, color them bold else color them bold red
For example:

 dput(test)
structure(list(Class = c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L), sil =
c(0.734,
0.734, 0.734, 0.734, 0.734, -0.03, -0.03, -0.03), M201.1637T.1 =
c(-1.077019059,
-1.025923945, -2.025907674, -1.223001413, -1.547348898, -0.376842603,
-1.33495095, -0.486811653), M203.1794T.1 = c(-0.884899777,
-0.878305283,
-1.910526051, -1.446826543, -1.950515819, -0.192865129, -1.669691644,
-0.636095942), M205.1950T.1 = c(-1.307163965, -1.022407192,
-2.050283307,
-1.508604131, -1.710170605, -0.197410826, -1.547129558, -0.780189201
), M207.2107T.1 = c(-1.378614081, -0.950293267, -1.714837198,
-1.827195011, -1.629677288, -0.064343778, -1.598304259, -0.502002575
)), .Names = c(Class, sil, M201.1637T.1, M203.1794T.1,
M205.1950T.1, M207.2107T.1), class = data.frame, row.names =
c(52T_D06_19_42,
500030X_B03_19_15, 500059R_G09_19_81, 500061V_H02_13_86,
500078W_D10_6_46, 500082M_D05_18_41, 500105S_B09_15_21,
500120W_B04_19_16)

Thanks in advance

Nico

   [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.

__
R-help@r-project.org mailing list
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.


Re: [R] Survey

2014-04-06 Thread David Winsemius


On Apr 6, 2014, at 2:36 AM, Anthony Damico wrote:

hi leandro, in case you're already familiar with ibge's pnad, you  
might

find these examples useful--

http://www.asdfree.com/search/label/pesquisa%20nacional%20por%20amostra%20de%20domicilios%20%28pnad%29

https://github.com/ajdamico/usgsd/tree/master/Pesquisa%20Nacional%20por%20Amostra%20de%20Domicilios

--they construct and analyze the sqlite-backed survey design that dr.
lumley is referring to


Thank you for this and all of your other work aimed at improving  
access to governmental data resource. The script for importation of  
the SEER text data ran flawlessly.


The link at the bottom of the page in the first link to Lumley's old  
page on database backed svy objects at UW is now at an r-forge hosted  
page:


http://r-survey.r-forge.r-project.org/survey/svy-dbi.html

--

David.




On Wed, Apr 2, 2014 at 6:58 PM, Thomas Lumley tlum...@uw.edu wrote:


On Thu, Apr 3, 2014 at 2:37 AM, Leandro Marino 
leandromar...@leandromarino.com.br wrote:


Dear R-Users,

I was using survey for the past years and now I am experiencing some
problems with scripts that was working in the past.

We are working with big data bases so I can't put all variables  
that I

will

use in the svydesign.



This was never supposed to work.

The variables shouldn't take up any more room in the survey design  
object
than they do anywhere else, but in any case the right solution when  
you
have enough memory for the variables in a given analysis but not  
for all
the variables in your dataset is to use the database-backed designs  
and put

the data in something like SQLite.

 -thomas

--
Thomas Lumley
Professor of Biostatistics
University of Auckland

   [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.


David Winsemius, MD
Alameda, CA, USA

__
R-help@r-project.org mailing list
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.


[R] structural equation models in R

2014-04-06 Thread thanoon younis
hi
i need your help to know how can i analysis structural equation models in R.

thanks alot

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.


[R] skipping an error message

2014-04-06 Thread Naser Jamil
Dear R-user,
May I seek your suggestion on an issue. I'm fitting non-linear mixed effects
model as a part of my large R program. But sometimes I get error messages
from it and the code stops working. In such cases, I want to skip the
iterations and
want to move to the next iteration ignoring all the subsequent
computations.

The following is only that part of the code which fits the mixed effects
model. I tried with tryCatch as shown below, but it's not serving my
purpose. I guess something is wrong in my approach.

###

grouped.data-groupedData(formula = conc ~ t | subject,
data = data.d)
model.d-nlme(conc~f2(dose,Theta1,Theta2,Theta3,t),
fixed=Theta1+Theta2+Theta3~1,
data=grouped.data,
random=Theta1+Theta2+Theta3~1,
start=list(fixed=ini.pkpara))
summ-summary(model.d) # summary of the model

tryCatch(summ, error = function() next)

###

Any suggestion will be more than great.

Thank you very much.


Regards,
Jamil

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.


[R] identical applied to data frames

2014-04-06 Thread Rguy
I have two data frames that I believe are identical, yet checking them with
identical() fails.

Each data frame has two columns named 'pk' and 'newv_f13__bool'. As shown
below, the columns of the data frames are identical, according to the
identical() function, yet the data frames themselves are not. How can this
be?

Browse[1] identical(shft$pk, shft_mat$pk)
[1] TRUE
Browse[1] identical(shft$newv_f13__bool, shft_mat$newv_f13__bool)
[1] TRUE
Browse[1] identical(shft, shft_mat)
[1] FALSE

I have attached a file in which the two data frames are saved (using the
save() function).
__
R-help@r-project.org mailing list
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.


[R] Question: Do I need to set refit=FALSE when testing for random effects with anova()?

2014-04-06 Thread Christian Brauner
Hello,

I am currently testing whether I should include certain random effects
in my lmer model or not. I use the anova function for that. My
procedure so far is to fit the model with a function call to lmer()
with REML=TRUE (the default option). Then I call anova() on the two
models where one of them does include the random effect to be tested
and the other one does not. However, it is well known that the anova()
function refits the models with ML (new versions also output a warning
that they do so). But in the new version of anova() you can prevent
anova() from doing so by setting the option refit=FALSE. In order to
test for random effects should I set refit=FALSE in my call to anova()
or not? If I do set refit=FALSE the p-values tend to be lower.
(Additional question: Are the p-values calculated by anova()
anti-conservative when I set refit=FALSE?)

Thanks for any help

__
R-help@r-project.org mailing list
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.


Re: [R] GGPLOT Question - #2

2014-04-06 Thread Philip Rhoades

People,


On 2014-04-06 22:31, Philip Rhoades wrote:

People,

OK, the last two bits of the puzzle - can I colour the bars
independently and change the scale from linear to logarithmic?



To answer my own question - the attached file works for me but I guess 
could be improved?


Thanks,

Phil.




On 2014-04-06 22:23, Philip Rhoades wrote:

Stephen,


On 2014-04-06 22:09, stephen sefick wrote:

add +coord_flip() at the end. Does that do it?



Wow! - that was a fast response! - yes that works - thanks a lot!

Regards,

Phil.


On Sun, Apr 6, 2014 at 7:03 AM, Philip Rhoades p...@pricom.com.au 
wrote:



People,

I have this script:

library(ggplot2)

df - read.table(text =  id min max
 Sp1 8.5 13.2
 Sp2 11.7 14.5
 Sp3 14.7 17.7 , header=TRUE)

ggplot(df) +
 geom_crossbar(aes(ymin = min, ymax = max, x = id, y = min),
 fill = blue, fatten = 0)

- is there some way to get geom_crossbar to print horizontally? - I
couldn't find it . . and there doesn't seem to be a horizontal 
equivalent?


Thanks,

Phil.
--
Philip Rhoades

GPO Box 3411
Sydney NSW  2001
Australia
E-mail:  p...@pricom.com.au

__
R-help@r-project.org mailing list
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.





--
Stephen Sefick
**
Auburn University
Biological Sciences
331 Funchess Hall
Auburn, Alabama
36849
**
sas0...@auburn.edu
http://www.auburn.edu/~sas0025
**

Let's not spend our time and resources thinking about things that are 
so
little or so large that all they really do for us is puff us up and 
make us
feel like gods.  We are mammals, and have not exhausted the annoying 
little

problems of being mammals.

-K. Mullis

A big computer, a complex algorithm and a long time does not equal
science.

  -Robert Gentleman

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.


--
Philip Rhoades

GPO Box 3411
Sydney NSW  2001
Australia
E-mail:  p...@pricom.com.aupdf( paper=a4r, width=11, height=7 )
options(scipen=999)

library(ggplot2)
library(scales)


df6 - read.table(text =  Treatment min max 
 \6 Surgical Cooling\ 0.01 0.2, header=TRUE)

df5 - read.table(text =  Treatment min max 
 \5 Medical Cooling\ 0.01 2, header=TRUE)

df4 - read.table(text =  Treatment min max 
 \4 Human Hibernation\ 0.01 14, header=TRUE)

df3 - read.table(text =  Treatment min max 
 \3 Short Term Suspended Animation\ 0.1 100, header=TRUE)

df2 - read.table(text =  Treatment min max 
 \2 Neural Archive Preservation\ 1 10, header=TRUE)

df1 - read.table(text = Treatment min max
 \1 Cryonic Suspension (whole body)\ 10 10, header=TRUE)

ggplot() +
 geom_crossbar( data = df1, aes( ymin = min, ymax = max, x = Treatment, y = min 
), fill = red, fatten = 0 ) +
 geom_crossbar( data = df2, aes( ymin = min, ymax = max, x = Treatment, y = min 
), fill = red, fatten = 0 ) +
 geom_crossbar( data = df3, aes( ymin = min, ymax = max, x = Treatment, y = min 
), fill = orange, fatten = 0 ) +
 geom_crossbar( data = df4, aes( ymin = min, ymax = max, x = Treatment, y = min 
), fill = orange, fatten = 0 ) +
 geom_crossbar( data = df5, aes( ymin = min, ymax = max, x = Treatment, y = min 
), fill = green, fatten = 0 ) +
 geom_crossbar( data = df6, aes( ymin = min, ymax = max, x = Treatment, y = min 
), fill = green, fatten = 0 ) +
 ylab( Days ) +
 scale_y_log10( breaks=c( 0.01, 0.1, 1.0, 10.0, 100.1, 1000.0, 1.0, 
10.0 ), labels=c( 0.01, 0.1, 1.0, 10, 100, 1,000, 10,000, 
100,000 ) ) +
 coord_flip() +
 ggtitle( Comparison of Medical Temperature Reduction Treatments )


__
R-help@r-project.org mailing list
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.


[R] Fwd: Recoding in R conditioned on a certain value.

2014-04-06 Thread David Winsemius


On Apr 5, 2014, at 8:37 PM, Kate Ignatius wrote:


Thanks,

I ended up using this.  I was curious how to get the mean of multiple
columns by chrom (or Plan with the example below).  Using this data
for example:

Plan   X   mm  mm2
1  95 0.323000 0.400303
1 275 0.341818 0.400303
1   2 0.618000 0.400303
1  75 0.32 0.400303
1  13 0.399000 0.400303
1  20 0.40 0.400303
2 219 0.393000 0.353350
2  50 0.06 0.353350
2 213 0.39 0.353350
2 204 0.496100 0.353350
2  19 0.393000 0.353350
2 201 0.388000 0.353350

I've tried:

pp$meanmm - with(pp, ave(pp[,3:4], Plan, FUN = mean))


People should do some 'dimensional analysis' when they get errors.  
(And they should report the text of the errors.) The length and width  
of what is specified on the LHS should be the same as what would be  
produced on the RHS of hte assignment. But that would not have been  
the first error that was encountered. You tried to pass two columns as  
the first argument to a function that expected one, and then you tried  
to assign the result to one column. This might have a better chance.


pp[ c('mean.m1' , 'mean.m2') ] - lapply( pp[ , 3:4] , function(x)  
ave(x, pp$Plan, FUN=mean) )



 pp
   Plan   X   mm  mm2  mean.m1  mean.m2
1 1  95 0.323000 0.400303 0.400303 0.400303
2 1 275 0.341818 0.400303 0.400303 0.400303
3 1   2 0.618000 0.400303 0.400303 0.400303
snipped

--
David.



But that doesn't seem to work.

On Sat, Apr 5, 2014 at 4:18 PM, David Winsemius dwinsem...@comcast.net 
 wrote:


On Apr 5, 2014, at 9:51 AM, Kate Ignatius wrote:


I'm trying to work out the average of a certain value by chromosome.
I've done the following, but it doesn't seem to work:

Say, I want to find average AD for chromosome 1 only and paste the
value next to all the positions on chromosome 1:

[sam$chrom == '1'] -
(sam$ad)/(colSums(sam[c(1:nrow(sam$chrom=='1'))],))


It looks wrong to me because of the mismatching lengths of the  
lhs and rhs but since you have not provided a test dataset that's  
all I will say.


The usual way to calculate a function within categorical groupings  
that will be re-inserted alongside the original dataframe is to  
use `ave`:


sam$mmad - with( sam, ave(ad, chrom, FUN=mean) )




I know this is convoluted and possible wrong... but I would like  
to do

this for all chromosomes.

Thanks!

--
David Winsemius
Alameda, CA, USA



David Winsemius, MD
Alameda, CA, USA


David Winsemius, MD
Alameda, CA, USA

__
R-help@r-project.org mailing list
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.


Re: [R] identical applied to data frames

2014-04-06 Thread David Winsemius


On Apr 6, 2014, at 7:00 AM, Rguy wrote:

I have two data frames that I believe are identical, yet checking  
them with

identical() fails.

Each data frame has two columns named 'pk' and 'newv_f13__bool'. As  
shown

below, the columns of the data frames are identical, according to the
identical() function, yet the data frames themselves are not. How  
can this

be?

Browse[1] identical(shft$pk, shft_mat$pk)
[1] TRUE
Browse[1] identical(shft$newv_f13__bool, shft_mat$newv_f13__bool)
[1] TRUE
Browse[1] identical(shft, shft_mat)
[1] FALSE


 It could be as simple as having a different column order:

 df1 - df4
 identical(df1,df4)
[1] TRUE
 df1[] - df1[rev(names(df1))]
 identical(df1,df4)
[1] FALSE



I have attached a file in which the two data frames are saved (using  
the

save() function).


No attachment. Probably not a text file. Read the general instructions  
page more carefully.


--

David Winsemius, MD
Alameda, CA, USA

__
R-help@r-project.org mailing list
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.


Re: [R] structural equation models in R

2014-04-06 Thread Patrick Coulombe
Hi Thanoon,

Not sure how we can help when you ask such a vague, broad question.
But in any case, I would recommend using the package lavaan in R.
Look it up: http://lavaan.ugent.be/

Patrick

2014-04-06 6:26 GMT-06:00 thanoon younis thanoon.youni...@gmail.com:
 hi
 i need your help to know how can i analysis structural equation models in R.

 thanks alot

 [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 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.

__
R-help@r-project.org mailing list
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.


Re: [R] structural equation models in R

2014-04-06 Thread Don McKenzie
There is also a newer package called “plspm” (“partial least squares path 
modeling”)

http://cran.r-project.org/web/packages/plspm/plspm.pdf

Even though it is called path modeling instead of SEM, it does seem to 
incorporate latent variables explicitly.

On Apr 6, 2014, at 11:17 AM, Patrick Coulombe patrick.coulo...@gmail.com 
wrote:

 Hi Thanoon,
 
 Not sure how we can help when you ask such a vague, broad question.
 But in any case, I would recommend using the package lavaan in R.
 Look it up: http://lavaan.ugent.be/
 
 Patrick
 
 2014-04-06 6:26 GMT-06:00 thanoon younis thanoon.youni...@gmail.com:
 hi
 i need your help to know how can i analysis structural equation models in R.
 
 thanks alot
 
[[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 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.
 
 __
 R-help@r-project.org mailing list
 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.

Don McKenzie
Research Ecologist
Pacific Wildland Fire Sciences Lab
US Forest Service

Affiliate Professor
School of Environmental and Forest Sciences
University of Washington
d...@uw.edu





[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.


Re: [R] structural equation models in R

2014-04-06 Thread Rich Shepard

On Sun, 6 Apr 2014, Patrick Coulombe wrote:


Not sure how we can help when you ask such a vague, broad question. But in
any case, I would recommend using the package lavaan in R. Look it up:
http://lavaan.ugent.be/


  There's also plspm for Partial Least Squares -- Path Modeling.

Rich

__
R-help@r-project.org mailing list
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.


Re: [R] Error Message using xyplot of lattice

2014-04-06 Thread arun
HI,
Check the output of:
datM - melt(DataSeries,id.var=Date)
head(datM,2)# 3 columns
# Date variable value 

#1 2001-01-01 A 4
#2 2001-01-02 A 1
datM1 - setNames(datM,LETTERS[c(24,26,25)])
library(lattice)
xyplot(Y~as.numeric(X),data=datM1,groups=Z,type=l) 


A.K.

hi, thank you for the help. doing this looks good, however I tried to adapt to 
code in order to be able to plot more than just 2 time series and I again get 
some Errors. using this: DataSeriesM - 
setNames(melt(DataSeries,id.var=Date),LETTERS[c(24,18,19,20,21,22,23,26,25)]) 
where DataSeries has 5000 observations of 9 variables, I get the error message: 
Error in setNames(melt(DataSeries, id.var = Date), LETTERS[c(24, 18,  : 
'names' attribute [9] must be the same length as the vector [3] If I run this: 
length(LETTERS[c(24,18,19,20,21,22,23,26,25)])
length(DataSeries) I get 9 for both. I don't really understand why it is not 
working, is there anything you see? Using your example, I tried this: 
set.seed(495)
DataSeries - data.frame(Date=seq(as.Date(2001-01-01),by=1 day, 
length.out=20), A= sample(10,20,replace=TRUE), B= rnorm(20),C= rnorm(20)-1) 
DataSeriesM - setNames(melt(DataSeries,id.var=Date),LETTERS[c(24,26,25,22)]) 
which dives me the same error message. How do I Need to adapt this part as well 
as the code below to plot more than 2 lines? # with legends
xyplot(Y~as.numeric(X),xlab=X,data=DataSeriesM,type=l,groups=Z,as.table=TRUE,main=Development
 over time,auto.key=list(x=.85, y=.95, border=TRUE,lines=TRUE)) 


On Sunday, April 6, 2014 2:14 AM, arun smartpink...@yahoo.com wrote:
Hi,
You didn't provide a reproducible example.  If your dataset is something like 
this:
set.seed(495)
DataSeries - data.frame(Date=seq(as.Date(2001-01-01),by=1 day, 
length.out=20), A= sample(10,20,replace=TRUE), B= rnorm(20))


###Using your codes:

Matrix_New1 - 
cbind(as.list(DataSeries[,Date]),as.list(DataSeries[,A]),colnames(DataSeries)[2])

Matrix_New2 - 
cbind(as.list(DataSeries[,Date]),as.list(DataSeries[,B]),colnames(DataSeries)[3])

str(Matrix_New1)
#List of 60
str(Matrix_New2) 

#List of 60 

Matrix_Complete- rbind(Matrix_New1,Matrix_New2)
str(Matrix_Complete)
#List of 120
Col_Names_MC-c(X,Y, Z)
colnames(Matrix_Complete)-Col_Names_MC 

library(lattice) 

Plot_AB-xyplot(Y~ X, data =Matrix_Complete, type =c(l), groups=Z, 
as.table=TRUE, main=Development over time)
#Error in eval(expr, envir, enclos) : object 'Z' not found 

#You could try:
library(reshape2)
 DataSeriesM - setNames(melt(DataSeries,id.var=Date),LETTERS[c(24,26,25)])
xyplot(Y~X,data=DataSeriesM,type=l,groups=Z,as.table=TRUE,main=Development 
over time)
 #for a numeric X axis
xyplot(Y~as.numeric(X),data=DataSeriesM,type=l,groups=Z,as.table=TRUE,main=Development
 over time) 
# with legends
xyplot(Y~as.numeric(X),xlab=X,data=DataSeriesM,type=l,groups=Z,as.table=TRUE,main=Development
 over time,auto.key=list(x=.85, y=.95, border=TRUE,lines=TRUE)) 


Hope it helps.

A.K.


Hi everbody, I have the following error message occuring when I run my code:
Error in eval(expr, envir, enclos) : object 'Series' not found The code I am 
using is the following: Matrix_New1 - 
cbind(as.list(DataSeries[,Date]),as.list(DataSeries[,A]),colnames(DataSeries)[2]
 )
Matrix_New2 - 
cbind(as.list(DataSeries[,Date]),as.list(DataSeries[,B]),colnames(DataSeries)[3]
 ) #whereas first and second columns should be numbers, third column is A and 
B respectively Matrix_Complete- rbind(Matrix_New1,Matrix_New2) 
Col_Names_MC-c(X,Y, Z)
colnames(Matrix_Complete)-Col_Names_MC Plot_AB-xyplot(Y~ X, data 
=Matrix_Complete, type =c(l), groups=Z, as.table=TRUE, main=Development over 
time) print(Plot_AB) Can you explain me why this way of creating a plot is not 
working and what I Need to Change in order to be able to plot it? 


__
R-help@r-project.org mailing list
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.


[R] Colour of geom_hline is not correct in legend

2014-04-06 Thread Kate Ignatius
I've used geom_point and geom_hline in ggplot2 and have gotten
satisfactory legends for both.  However, I have one black line and one
blue line in the figure but in the legend they are both black - how
can I correct this in the legend to be the right colors?

mcgc - ggplot(sam, aes(x = m,y = ad, colour = X)) +
  geom_point(size = 0.75) +
  scale_colour_gradient2(high=red, mid=green,
limits=c(0,1), guide = colourbar) +
  geom_hline(aes(yintercept = mad, linetype =
mad), colour = blue, size=0.75, show_guide = TRUE) +
  geom_hline(aes(yintercept = mmad, linetype =
mmad), colour = black, size=0.75, show_guide = TRUE)  +
  facet_wrap(~ Plan, scales = free, ncol = 4) +
  scale_linetype_manual(name = Plan of Health
Care, values = c(mad = 1, mmad = 1),guide = legend)

I'm sure I've over written something here... just not sure where (am
new to ggplot)

Data:

Plan  ad X   m  mad  mmad
1  1 95 0.323000 0.400303 0.12
1  2 275 0.341818 0.400303 0.12
1  3  2 0.618000 0.400303 0.12
1  4 75 0.32 0.400303 0.12
1  5 13 0.399000 0.400303 0.12
1  6 20 0.40 0.400303 0.12
2  1 219 0.393000 0.353350 0.45
2  2 50 0.06 0.353350 0.45
2  3 213 0.39 0.353350 0.45
2  4 204 0.496100 0.353350 0.45
2  5 19 0.393000 0.353350 0.45
2  6 201 0.388000 0.353350 0.45

Plan goes up to 40, but I've only included a snippet of data here...

__
R-help@r-project.org mailing list
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.


Re: [R] structural equation models in R

2014-04-06 Thread John Fox
Dear thanoon younis,

RSiteSearch(structural equation model, functions) turns up a number of
relevant packages.

I hope this helps,
 John

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of thanoon younis
 Sent: Sunday, April 06, 2014 8:26 AM
 To: r-help@r-project.org
 Subject: [R] structural equation models in R
 
 hi
 i need your help to know how can i analysis structural equation models
 in R.
 
 thanks alot
 
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 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.

__
R-help@r-project.org mailing list
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.


Re: [R] identical applied to data frames

2014-04-06 Thread Rolf Turner

On 07/04/14 02:00, Rguy wrote:

I have two data frames that I believe are identical, yet checking them with
identical() fails.

Each data frame has two columns named 'pk' and 'newv_f13__bool'. As shown
below, the columns of the data frames are identical, according to the
identical() function, yet the data frames themselves are not. How can this
be?

Browse[1] identical(shft$pk, shft_mat$pk)
[1] TRUE
Browse[1] identical(shft$newv_f13__bool, shft_mat$newv_f13__bool)
[1] TRUE
Browse[1] identical(shft, shft_mat)
[1] FALSE

I have attached a file in which the two data frames are saved (using the
save() function).


Attachment did not come through.

What does all.equal() say about your two data frames?

cheers,

Rolf Turner

__
R-help@r-project.org mailing list
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.


Re: [R] GGPLOT Question - #2

2014-04-06 Thread Yvan Richard
Hi Phil,
You don't need multiple data frames. A single one will do. Try that.

df - rbind(df1, df2, df3, df4, df5, df6)
df$type - c('a','a','b','b','c','c')
ggplot() +
geom_crossbar(data = df, aes(ymin=min, ymax=max, x=Treatment,
y=min, fill=type, fatten=0)) +
scale_fill_manual(values=c(a='red', b='orange', c='green'), guid='none') +
ylab( Days ) +
scale_y_log10( breaks=c( 0.01, 0.1, 1.0, 10.0, 100.1, 1000.0,
1.0, 10.0 ), labels=c( 0.01, 0.1, 1.0, 10, 100,
1,000, 10,000, 100,000 ) ) +
coord_flip() +
ggtitle( Comparison of Medical Temperature Reduction Treatments )


On 7 April 2014 03:38, Philip Rhoades p...@pricom.com.au wrote:
 People,



 On 2014-04-06 22:31, Philip Rhoades wrote:

 People,

 OK, the last two bits of the puzzle - can I colour the bars
 independently and change the scale from linear to logarithmic?



 To answer my own question - the attached file works for me but I guess could
 be improved?


 Thanks,

 Phil.



 On 2014-04-06 22:23, Philip Rhoades wrote:

 Stephen,


 On 2014-04-06 22:09, stephen sefick wrote:

 add +coord_flip() at the end. Does that do it?



 Wow! - that was a fast response! - yes that works - thanks a lot!

 Regards,

 Phil.


 On Sun, Apr 6, 2014 at 7:03 AM, Philip Rhoades p...@pricom.com.au
 wrote:

 People,

 I have this script:

 library(ggplot2)

 df - read.table(text =  id min max
  Sp1 8.5 13.2
  Sp2 11.7 14.5
  Sp3 14.7 17.7 , header=TRUE)

 ggplot(df) +
  geom_crossbar(aes(ymin = min, ymax = max, x = id, y = min),
  fill = blue, fatten = 0)

 - is there some way to get geom_crossbar to print horizontally? - I
 couldn't find it . . and there doesn't seem to be a horizontal
 equivalent?

 Thanks,

 Phil.
 --
 Philip Rhoades

 GPO Box 3411
 Sydney NSW  2001
 Australia
 E-mail:  p...@pricom.com.au

 __
 R-help@r-project.org mailing list
 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.




 --
 Stephen Sefick
 **
 Auburn University
 Biological Sciences
 331 Funchess Hall
 Auburn, Alabama
 36849
 **
 sas0...@auburn.edu
 http://www.auburn.edu/~sas0025
 **

 Let's not spend our time and resources thinking about things that are so
 little or so large that all they really do for us is puff us up and make
 us
 feel like gods.  We are mammals, and have not exhausted the annoying
 little
 problems of being mammals.

 -K. Mullis

 A big computer, a complex algorithm and a long time does not equal
 science.

   -Robert Gentleman

 [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 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.


 --
 Philip Rhoades

 GPO Box 3411
 Sydney NSW  2001
 Australia
 E-mail:  p...@pricom.com.au

 __
 R-help@r-project.org mailing list
 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.




-- 
Yvan Richard

  DRAGONFLY Science

Physical address: Level 5, 158 Victoria St, Te Aro, Wellington
Postal address: PO Box 27535, Wellington 6141
New Zealand
Ph: 04.385.9285
web page

__
R-help@r-project.org mailing list
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.


[R] Manipulating x axis using scale_x_continuous (but a factor is used). Is there a work around?

2014-04-06 Thread Kate Ignatius
My code that I've used is:

mcgc - ggplot(sam, aes(x = person,y = m, colour = X)) +
  geom_point(size = 0.75) +
  scale_colour_gradient2(high=red, mid=green,
limits=c(0,1), guide = colourbar) +
  geom_hline(aes(yintercept = mad, linetype = mad),
colour = blue, size=0.75, show_guide = TRUE) +
  geom_hline(aes(yintercept = mmad, linetype =
mmad), colour = black, size=0.75, show_guide = TRUE)  +
  facet_wrap(~ Plan, scales = free, ncol = 4) +
  scale_linetype_manual(name = Plan of Health Care,
values = c(mad = 1, mmad = 1),guide = legend)

For this data:

Data:

Plan  Person X   m  mad  mmad
1  1 95 0.323000 0.400303 0.12
1  2 275 0.341818 0.400303 0.12
1  3  2 0.618000 0.400303 0.12
1  4 75 0.32 0.400303 0.12
1  5 13 0.399000 0.400303 0.12
1  6 20 0.40 0.400303 0.12
2  7 219 0.393000 0.353350 0.45
2  8 50 0.06 0.353350 0.45
2  9 213 0.39 0.353350 0.45
2  15 204 0.496100 0.353350 0.45
2  19 19 0.393000 0.353350 0.45
2  24 201 0.388000 0.353350 0.45
3  30 219 0.567 0.1254 0.89
3  14 50 0.679 0.1254 0.89
3  55 213 0.1234 0.1254 0.89
3  18 204 0.6135 0.1254 0.89
3  59 19 0.39356 0.1254 0.89
3  101 201 0.300 0.1254 0.89

I'm trying to manipulate the x axis using the following, only because
the data can get very large and there is just way too many Persons to
fit on the x-axis and I need to reduce it so its legible:

scale_x_continuous(breaks = c(min(person), median(person),
max(person)), labels = c(min(person), median(person), max(person)))

However, given that I had to change `person` into a factor to order
the data properly, the above code does not work.  I get the errors,
depending on how I fiddle around with the code:

Error: Discrete value supplied to continuous scale
Error in Summary.factor(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L,  :
  min not meaningful for factors

Changing `person` to numeric does not work, as the accumulated
`person` for the entire dataset will then be on each Plan figure
panel, as opposed to the scale specific for each Plan. That is, the
x-axis for each panel (Plan) should have a scale beginning from its
lowest Person to its highest Person (ie Plan 1 should have an x-axis
that goes from 1 to 6 but Plan 3 has one that goes from 14 to 101).
Changing the Person to numeric, the x-axis for all panels starts at 1
and goes to 101.

Is there a work around for this?

__
R-help@r-project.org mailing list
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.


Re: [R] skipping an error message

2014-04-06 Thread Jim Lemon

On 04/06/2014 08:21 PM, Naser Jamil wrote:

Dear R-user,
May I seek your suggestion on an issue. I'm fitting non-linear mixed effects
model as a part of my large R program. But sometimes I get error messages
from it and the code stops working. In such cases, I want to skip the
iterations and
want to move to the next iteration ignoring all the subsequent
computations.

The following is only that part of the code which fits the mixed effects
model. I tried with tryCatch as shown below, but it's not serving my
purpose. I guess something is wrong in my approach.

###

grouped.data-groupedData(formula = conc ~ t | subject,
data = data.d)
model.d-nlme(conc~f2(dose,Theta1,Theta2,Theta3,t),
fixed=Theta1+Theta2+Theta3~1,
data=grouped.data,
random=Theta1+Theta2+Theta3~1,
start=list(fixed=ini.pkpara))
summ-summary(model.d) # summary of the model

tryCatch(summ, error = function() next)

###


Hi Jamil,
I think you have to pass the expression:

nlme(conc~f2(dose,Theta1,Theta2,Theta3,t),
 fixed=Theta1+Theta2+Theta3~1,
 data=grouped.data,
 random=Theta1+Theta2+Theta3~1,
 start=list(fixed=ini.pkpara))

not the result of the expression.

Jim

__
R-help@r-project.org mailing list
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.


Re: [R] Any solution to have RnetCDF, ncdf or ncdf4 in R 3.1 ?

2014-04-06 Thread Marc Girondot

Le 06/04/2014 16:47, David W. Pierce a écrit :

Hi Marc,

those packages are just interfaces to the netcdf library that must 
already exist on your machine. Try installing the netcdf library 
first, and then installing the R package.


You will need the development version of the netcdf library installed 
in order to compile the R packages. Hopefully the exact package name 
will be obvious in the package manager on your system.




Thanks a lot for these infos.
Here are the last news for my problem of installation package in 3.1:

I have installed macport and then I have tried to install development 
version of netcdf library:

sudo port install netcdf-devel
Error: Port netcdf-devel not found

The netcdf library is available in macport but not the development one.

In the meantime, I have tried to install ncdf and ncdf4 package after 
downloading the MacosX binary versions at:

http://cran.r-project.org/bin/macosx/contrib/r-release/ncdf_1.6.6.tgz
http://cran.r-project.org/bin/macosx/contrib/r-release/ncdf4_1.10.tgz

I have installed both using the install_local() function of the package 
devtools.

Both install and run correctly.

The same procedure applied to RNetCDF 
(http://cran.r-project.org/web/packages/RNetCDF/index.html) has produced 
an error during installation.


I have installed other packages in 3.1, or directly using 
install.packages() or loading the MacosX binary and using 
install_local(). I have still a problem with rgdal 
(http://cran.r-project.org/web/packages/rgdal/index.html). Probably 
again it is a problem of library (gdal) that is not present. I will wait 
that binary library is available in CRAN.


Marc

__
R-help@r-project.org mailing list
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.


[R] simple linear plots with a loop

2014-04-06 Thread Kristi Glover
Hi R users,
I was trying to plot with  a fixed y with many independet variables. I tried 
this loop but it did not work. any suggestions? I wanted to make 9 plots. This 
is a just an example data. 

dat1- as.data.frame(matrix(sample(1:20,100,replace=TRUE),ncol=10))
lapply(seq_len(ncol(dat1)),function(i) 
{
par(mfrow=c(3,3)),
plot(dat1[,1],dat1[,i+1],
z[,i]-lm(dat1[,1]~dat1[,i+1]),
abline(z),
summary(z[,i])
}
 here first column is dependent variable and other V2 to V10s are independent 
variables. Also wanted look the summary (linear model) with each variable.
Thanks for your suggestions
KG
===
 
  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.


Re: [R] Multic for windows 7 and Ubuntu

2014-04-06 Thread Srinivasan, Sathish K
Thanks  for your replies.

 After doing a search on rhelp and r-sig-debian yours seems to be the first. 
 Shouldn't you be providing much more detail regarding your current setup and 
 versions of R and compilers, methods you are using, and the errors you are 
 getting? Review the Posting Guide for a checklist. (And : You are mentioning 
 both Windows7 and Linux distro which adds to the ambiguity and lack of 
 clarity.). The README says the package needs compilation and provided details 
 about how to go about that and who to contact with specific requests for 
 information about your setup:
http://cran.r-project.org/web/packages/multic/README

Installation Error is related to Segmentation Fault. I did not save the error 
message, I wish I could post it here.
gcc compiler version is 4.6.3

 Also, there is no active support for windows binary version.
Yes? The message linked to is a generic CRAN message. What is the point of 
mentioning this?

I mentioned it, because the multic package is a unix/linux library. There is no 
support for Windows PC. I thought any one might provide support for multic 
package on windows PC.

 Could any one please help me install multic package on ubuntu 12.04, 64 bit 
 system running with R 2.14.2 version.
I'm not a Linux user so probably am speaking out of place and only doing so 
because it is the weekend and I've noticed that the traffic is slow on the 
mailing list on weekends. I believe Ubuntu is a fork of Debian so you may want 
to pay particular attention to mentions of Debian specific instructions in the 
links below. Many of the questions I have seen on R help from ubuntu users who 
have difficulties with installing packages get resolved by re-installing R 
using the development version of R. I have seen the use of r-base-dev as a 
target.
http://cran.r-project.org/doc/manuals/R-admin.html#Essential-and-useful-other-programs-under-a-Unix_002dalike
http://cran.r-project.org/doc/manuals/R-admin.html#Installing-R-under-Unix_002daikes
There is also a Debian R mailing list and the archives are at markmail 
(although I suspect those are not he official ones.)
http://markmail.org/search/+list:org%2Er-project%2Er-sig-debian

 I fixed the installation issue on ubuntu 12.04, by rebooting my system and 
installed multic on  a fresh R (2.14.1) session. It works well!


Thanks
 Sathish

From: Qiang Kou [q...@umail.iu.edu]
Sent: Saturday, April 05, 2014 9:23 PM
To: David Winsemius
Cc: Srinivasan, Sathish  K; r-help@r-project.org
Subject: Re: [R] Multic for windows 7 and Ubuntu

I have just test the package on Ubuntu 12.04, everything is OK.

So please provide the error message on your computer.

Best,

KK


On Sat, Apr 5, 2014 at 9:02 PM, David Winsemius 
dwinsem...@comcast.netmailto:dwinsem...@comcast.net wrote:

On Apr 5, 2014, at 1:50 AM, Srinivasan, Sathish K wrote:

 Hi all,
 Does anyone have issues installing multic package 
 (http://cran.r-project.org/web/packages/multic/index.html) on ubuntu.

After doing a search on rhelp and r-sig-debian yours seems to be the first. 
Shouldn't you be providing much more detail regarding your current setup and 
versions of R and compilers, methods you are using, and the errors you are 
getting? Review the Posting Guide for a checklist. (And : You are mentioning 
both Windows7 and Linux distro which adds to the ambiguity and lack of 
clarity.). The README says the package needs compilation and provided details 
about how to go about that and who to contact with specific requests for 
information about your setup:

http://cran.r-project.org/web/packages/multic/README

 Also, there is no active support for windows binary version.

Yes? The message linked to is a generic CRAN message. What is the point of 
mentioning this?

 Could any one please help me install multic package on ubuntu 12.04, 64 bit 
 system running with R 2.14.2 version.

I'm not a Linux user so probably am speaking out of place and only doing so 
because it is the weekend and I've noticed that the traffic is slow on the 
mailing list on weekends. I believe Ubuntu is a fork of Debian so you may want 
to pay particular attention to mentions of Debian specific instructions in the 
links below. Many of the questions I have seen on R help from ubuntu users who 
have difficulties with installing packages get resolved by re-installing R 
using the development version of R. I have seen the use of r-base-dev as a 
target.

http://cran.r-project.org/doc/manuals/R-admin.html#Essential-and-useful-other-programs-under-a-Unix_002dalike

http://cran.r-project.org/doc/manuals/R-admin.html#Installing-R-under-Unix_002dalikes

There is also a Debian R mailing list and the archives are at markmail 
(although I suspect those are not he official ones.)

http://markmail.org/search/+list:org%2Er-project%2Er-sig-debian



 Thanks
 Sathish

Please ... read.
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 

Re: [R] simple linear plots with a loop

2014-04-06 Thread David Winsemius


On Apr 6, 2014, at 6:07 PM, Kristi Glover wrote:


Hi R users,
I was trying to plot with  a fixed y with many independet variables.


It looks like you are plotting with a fixed x.


I tried this loop but it did not work. any suggestions?


Yes. Explain what did not work means. Error? Then post the error  
message. Different results than expected? Then describe.




I wanted to make 9 plots. This is a just an example data.

dat1- as.data.frame(matrix(sample(1:20,100,replace=TRUE),ncol=10))
lapply(seq_len(ncol(dat1)),function(i)
{
par(mfrow=c(3,3)),
plot(dat1[,1],dat1[,i+1],
z[,i]-lm(dat1[,1]~dat1[,i+1]),


What were you expecting to happen to dat1[,i+1] when i was at its  
max?



abline(z),
summary(z[,i])
}
here first column is dependent variable and other V2 to V10s are  
independent variables. Also wanted look the summary (linear model)  
with each variable.

Thanks for your suggestions
KG
===


Please post in plain text.



[[alternative HTML version deleted]]


--

David Winsemius, MD
Alameda, CA, USA

__
R-help@r-project.org mailing list
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.


Re: [R] simple linear plots with a loop

2014-04-06 Thread Jim Lemon

On 04/07/2014 11:07 AM, Kristi Glover wrote:

Hi R users,
I was trying to plot with  a fixed y with many independet variables. I tried 
this loop but it did not work. any suggestions? I wanted to make 9 plots. This 
is a just an example data.

dat1- as.data.frame(matrix(sample(1:20,100,replace=TRUE),ncol=10))
lapply(seq_len(ncol(dat1)),function(i)
{
par(mfrow=c(3,3)),
plot(dat1[,1],dat1[,i+1],
z[,i]-lm(dat1[,1]~dat1[,i+1]),
abline(z),
summary(z[,i])
}
  here first column is dependent variable and other V2 to V10s are independent 
variables. Also wanted look the summary (linear model) with each variable.
Thanks for your suggestions
KG


Hi Kristi,
You can get your plots like this:

for(i in 2:10) {
 plot(dat1[,1],dat1[,i],ylab=paste(dat1[,,i,],sep=))
 z-lm(dat1[,1]~dat1[,i])
 abline(z)
 print(summary(z))
}

This prints the summaries on the console. If you want to get a listing 
with plots and summaries together, there are a number of ways, one of 
which is the htmlize function in the prettyR package. Save the following 
to a file named kg.R:


#title~Example listing with htmlize
z[[1]]-NULL
png(kg.png,width=600,height=600)
par(mfrow=c(3,3))
for(i in 2:10) {
 plot(dat1[,1],dat1[,i],ylab=paste(dat1[,,i,],sep=))
 z[[i]]-lm(dat1[,1]~dat1[,i])
 abline(z[[i]])
}
dev.off()
for(i in 1:9) print(summary(z[[i]]))

then:

library(prettyR)
htmlize(kg.R)

Jim

__
R-help@r-project.org mailing list
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.


[R] How to make a proper use of blocking in limma using voom

2014-04-06 Thread Catalina Aguilar Hurtado
Hi all,

I have a RNAseq data to analyse were I have a control and a one treatment
for different individuals. I need to block the effects of the individual,
but I am having several troubles to get the data that I need. I am using
voom because my data is very heterogeneous and voom seams to do a good job
normalising my reads.

I am having the following issues:

   1.

   I want to get the differentially expressed genes (DEGs) of my treatment
   not of my control. I don't understand after the eBayes analysis why I get
   the coefficients for both. I have tried a  makeContrasts (TreatvsCont=
   c2-co, levels = design) to subtract the control effect but then I get 0
   DEGs.
   2.

   I am not sure when to include the 0 (null model) in the model formula, I
   have read examples for both types of models.

This are my targets, with my column names of my counts, individual and
condition

targets

Individual condition

A1 1 co

A2 3 co

A4 4 co

A5 5 co

E1 1 c2

E2 2 c2

E3 3 c2

E4 4 c2

E5 5 c2

This is the code I have been trying:

co2=as.matrix(read.table(2014_04_02_1h_PB.csv,header=T, sep=,,
row.names=1))

nf = calcNormFactors (co2)

targets= read.table (targets.csv, header = T, sep=,,row.names=1)

treat - factor (targets$condition, levels= c(co, c2))

design - model.matrix(~0+treat)

colnames (design) - levels (treat)

y - voom(co2,design,lib.size=colSums(co2)*nf)

corfit - duplicateCorrelation(y,design,block=targets$Individual)

fit -
lmFit(y,design,block=targets$Individual,correlation=corfit$consensus)

fit2- eBayes (fit)

results_trt - topTable (fit2, coef=c2, n=nrow (y), sort.by=none)

From which gives me 18,000 genes with adj.P.Val  0.01 out of 22,000 genes
that I have in total. Which makes no sense..

Thanks in advance for the help.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.