[R] clust algorithm for interval-typed data

2013-07-22 Thread Cheng, Yi
Hi:

I am looking for clust algorithms for interval-typed data. (for example, the 
session data with start time and end time).

I can't find it.

Please help to point me to any existing.

Cheng Yi

[[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] Some doubts on the application of RHadoop

2013-07-22 Thread xl Liang
Hi everyone, I am new to R , I have some doubts about RHadoop. Can  the
classification algorithms or data mining algorithms be used in the Rhadoop
as well as it used in R? If so, are there some different usages in
the achitecture of code? Are there some reference books or website listed
some examples for me to learn how to use such kind of algorithms on RHadoop?

[[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] about mix type clust algorithm

2013-07-22 Thread Cheng, Yi
Hi:
I have tried to find the appropriate clust algorithm for mixed type of data.
The suggested way I see is:

1.   use daisy to get the dissimilarity matrix

2.   use PAM/hclust by providing the dissimilarity matrix, to get the 
clusters
but by following this, when the data set grows bigger say 10,000 rows of data, 
the dissimilarity matrix will be O(n^2), and out of memory will occur.
I am wondering is there any better ways to do the mixed type cluster?

Cheng Yi


[[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] [R-pkgs] Version 1.0 of the R package frontier released

2013-07-22 Thread Arne Henningsen
Dear all

I am happy to announce that version 1.0 of the frontier package is
available on CRAN. The R package frontier provides tools for
analysing efficiency and productivity using the stochastic frontier
approach. This R package is based on Tim Coelli's DOS software
FRONTIER 4.1 and has been available on CRAN for almost 5 years now.
After many improvements of the source code, a few additional features,
and a few changes of the user interface in the beginning, the code and
the user interface have been rather stable in the previous 2.5 years.
The frontier package has been used by many R users and many
applications have proven its reliability. Therefore, I have called the
latest version of this package 1.0. This version is almost identical
to the previous versions but it includes citation information and the
argument farrell of efficiencies.frontier() has been renamed as
minusU and the argument farrell of summary.frontier() has been
renamed as effMinusU, because the term farrell was misleading in
some cases. The argument farrell can still be used for maintaining
backward-compatibility.

http://cran.r-project.org/package=frontier

https://r-forge.r-project.org/projects/frontier/

Best regards,
Arne

--
Arne Henningsen
http://www.arne-henningsen.name

___
R-packages mailing list
r-packa...@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-packages

__
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] Calculate interaction for a big dataframe

2013-07-22 Thread Arnaud Michel

Hi

To calculate the value of the interaction between factors of a dataframe 
df, does exist any function which could replace the function when the 
dataframe df has the numbers of rows of df is large (~55000) and also 
the numbers of combinaison of the three factors is large. The calcul abort.

The function to calculate the interaction is :
as.numeric(interaction(df [,c(1:3)],drop=TRUE))

To complete the question and to calculate interaction beetween 3 factors 
f1, f2, f3, does it possible to calculate first f12 = interaction 
(f1,f2) and after calculate interaction (f12, f3).

It seems to me that yes.

Thanks for your help




--
Michel ARNAUD
Chargé de mission auprès du DRH
DGDRD-Drh - TA 174/04
Av Agropolis 34398 Montpellier cedex 5
tel : 04.67.61.75.38
fax : 04.67.61.57.87
port: 06.47.43.55.31

__
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] problem loading large xlsx file into r

2013-07-22 Thread Jim Holtman
try the XLConnect package and if possible change the xlsx to xls format 
for better performance.

Sent from my iPad

On Jul 22, 2013, at 1:24, S N V Krishna kris...@primps.com.sg wrote:

 Hi,
 
 I am facing trouble when trying to read large xlsx file into R. please find 
 the code and error below. The file I was trying to read has 36,500 rows X 188 
 col, ~ 37 MB size.
 
 options( java.parameters = -Xmx4g )
 
 library(xlsx)
 Loading required package: xlsxjars
 Loading required package: rJava
 
 cftc = read.xlsx(d:\\Krishna\\Research\\CFTC_COT\\cftcdata.xlsx, 1)
 Error in .jcall(RJavaTools, Ljava/lang/Object;, invokeMethod, cl,  :
  java.lang.OutOfMemoryError: Java heap space
 
 sessionInfo()
 R version 3.0.1 (2013-05-16)
 Platform: x86_64-w64-mingw32/x64 (64-bit)
 
 locale:
 [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252
 [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
 [5] LC_TIME=English_United States.1252
 
 attached base packages:
 [1] stats graphics  grDevices utils datasets  methods   base
 
 other attached packages:
 [1] xlsx_0.5.1 xlsxjars_0.5.0 rJava_0.9-5
 
 Many thanks for the help and guidance.
 
 Regards,
 
 Krishna
 
[[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.


[R] union of a list of logical values

2013-07-22 Thread Liviu Andronic
Dear all,
How can I obtain the union of a list of logical values?

Consider the following:
x - head(iris)
x[,c(2,4)] - NA
x[c(2,4),] - NA
#  x
# Sepal.Length Sepal.Width Petal.Length Petal.Width Species
# 1  5.1  NA  1.4  NA  setosa
# 2   NA  NA   NA  NANA
# 3  4.7  NA  1.3  NA  setosa
# 4   NA  NA   NA  NANA
# 5  5.0  NA  1.4  NA  setosa
# 6  5.4  NA  1.7  NA  setosa
z - data.frame(!is.na(x))
#  z
# Sepal.Length Sepal.Width Petal.Length Petal.Width Species
# 1 TRUE   FALSE TRUE   FALSETRUE
# 2FALSE   FALSEFALSE   FALSE   FALSE
# 3 TRUE   FALSE TRUE   FALSETRUE
# 4FALSE   FALSEFALSE   FALSE   FALSE
# 5 TRUE   FALSE TRUE   FALSETRUE
# 6 TRUE   FALSE TRUE   FALSETRUE

I did find a solution, but it seems more like a hack:
 ##union of logical values by rows (union of list of logical values)
 as.logical(rowSums(z))
[1]  TRUE FALSE  TRUE FALSE  TRUE  TRUE
 ##union of logical values by columns
 as.logical(colSums(z))
[1]  TRUE FALSE  TRUE FALSE  TRUE

Another unusable monstrosity is as follows:
 ##union of list of logical values
 z[[1]] | z[[2]] | z[[3]] | z[[4]] | z[[5]]
[1]  TRUE FALSE  TRUE FALSE  TRUE  TRUE

Is there a more elegant way to approach this problem and obtain the
above logical vectors? Regards,
Liviu


-- 
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail

__
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] union of a list of logical values

2013-07-22 Thread Prof Brian Ripley

On 22/07/2013 10:16, Liviu Andronic wrote:

Dear all,
How can I obtain the union of a list of logical values?


This really only makes sense for a list of logical vectors of the same 
length.  And by 'union' you seem to mean 'or'.


Two approaches

1) Make a logical matrix and use apply(m, 1, any)

2) Use Reduce(`|`, z)



Consider the following:
x - head(iris)
x[,c(2,4)] - NA
x[c(2,4),] - NA
#  x
# Sepal.Length Sepal.Width Petal.Length Petal.Width Species
# 1  5.1  NA  1.4  NA  setosa
# 2   NA  NA   NA  NANA
# 3  4.7  NA  1.3  NA  setosa
# 4   NA  NA   NA  NANA
# 5  5.0  NA  1.4  NA  setosa
# 6  5.4  NA  1.7  NA  setosa
z - data.frame(!is.na(x))
#  z
# Sepal.Length Sepal.Width Petal.Length Petal.Width Species
# 1 TRUE   FALSE TRUE   FALSETRUE
# 2FALSE   FALSEFALSE   FALSE   FALSE
# 3 TRUE   FALSE TRUE   FALSETRUE
# 4FALSE   FALSEFALSE   FALSE   FALSE
# 5 TRUE   FALSE TRUE   FALSETRUE
# 6 TRUE   FALSE TRUE   FALSETRUE

I did find a solution, but it seems more like a hack:

##union of logical values by rows (union of list of logical values)
as.logical(rowSums(z))

[1]  TRUE FALSE  TRUE FALSE  TRUE  TRUE

##union of logical values by columns
as.logical(colSums(z))

[1]  TRUE FALSE  TRUE FALSE  TRUE

Another unusable monstrosity is as follows:

##union of list of logical values
z[[1]] | z[[2]] | z[[3]] | z[[4]] | z[[5]]

[1]  TRUE FALSE  TRUE FALSE  TRUE  TRUE

Is there a more elegant way to approach this problem and obtain the
above logical vectors? Regards,
Liviu





--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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] Select csv files by choosing datetime

2013-07-22 Thread R_Antony
Hi,

how can we read particular files from a path ? - i mean, i need to read csv
files which is created between two date and time. Here i need to get
filename along with path.

Thanks,
Antony.



--
View this message in context: 
http://r.789695.n4.nabble.com/Select-csv-files-by-choosing-datetime-tp4672023.html
Sent from the R help mailing list archive at Nabble.com.

__
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] union of a list of logical values

2013-07-22 Thread Liviu Andronic
On Mon, Jul 22, 2013 at 11:37 AM, Prof Brian Ripley
rip...@stats.ox.ac.uk wrote:
 This really only makes sense for a list of logical vectors of the same
 length.  And by 'union' you seem to mean 'or'.

Indeed.


 Two approaches

 1) Make a logical matrix and use apply(m, 1, any)

Of course! I tried apply(m, 1, |) without luck, but I should have
used apply(m, 1, any) instead.

Thank you,
Liviu


 2) Use Reduce(`|`, z)



 Consider the following:
 x - head(iris)
 x[,c(2,4)] - NA
 x[c(2,4),] - NA
 #  x
 # Sepal.Length Sepal.Width Petal.Length Petal.Width Species
 # 1  5.1  NA  1.4  NA  setosa
 # 2   NA  NA   NA  NANA
 # 3  4.7  NA  1.3  NA  setosa
 # 4   NA  NA   NA  NANA
 # 5  5.0  NA  1.4  NA  setosa
 # 6  5.4  NA  1.7  NA  setosa
 z - data.frame(!is.na(x))
 #  z
 # Sepal.Length Sepal.Width Petal.Length Petal.Width Species
 # 1 TRUE   FALSE TRUE   FALSETRUE
 # 2FALSE   FALSEFALSE   FALSE   FALSE
 # 3 TRUE   FALSE TRUE   FALSETRUE
 # 4FALSE   FALSEFALSE   FALSE   FALSE
 # 5 TRUE   FALSE TRUE   FALSETRUE
 # 6 TRUE   FALSE TRUE   FALSETRUE

 I did find a solution, but it seems more like a hack:

 ##union of logical values by rows (union of list of logical values)
 as.logical(rowSums(z))

 [1]  TRUE FALSE  TRUE FALSE  TRUE  TRUE

 ##union of logical values by columns
 as.logical(colSums(z))

 [1]  TRUE FALSE  TRUE FALSE  TRUE

 Another unusable monstrosity is as follows:

 ##union of list of logical values
 z[[1]] | z[[2]] | z[[3]] | z[[4]] | z[[5]]

 [1]  TRUE FALSE  TRUE FALSE  TRUE  TRUE

 Is there a more elegant way to approach this problem and obtain the
 above logical vectors? Regards,
 Liviu




 --
 Brian D. Ripley,  rip...@stats.ox.ac.uk
 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595



-- 
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail

__
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

2013-07-22 Thread Mª Teresa Martinez Soriano
HI everyoneI sent you an e-mail yesterday about apply function, this morning I 
have done something else but I still having problems, could you help me? Thanks 
in advance


DATOS
 NUMERO Provincia CENAES   IE.2005   IE.2006   IE.2007  IE.2008
29183  Alicante  771142.00046.00055.000   47.00030
479  Alicante  8299  1158.000   476.000   503.000  300.00031591  
Alicante  8129   540.000   764.000  1037.000  938.00032   1429  
Alicante  8219  5233.000  6234.000  4659.000 2212.00033   2681  
Alicante  829917.000 8.00010.0009.00034   3374  
Alicante  8299   346.000   416.000   343.000  330.00035   5341  
Alicante  8299  1198.000  1531.000   235.0000.00036   5772  
Alicante  7732   709.000   689.000   584.000  419.00037   6127  
Alicante  7711   225.000   125.000   175.000   71.00038   6132  
Alicante  7711  1084.000   634.000   592.000  291.00039   6133  
Alicante  7711  5143.000  5838.000  7136.000 7835.00040   6134  
Alicante  7711   327.000   394.000   442.000  331.00041   6138  
Alicante  7739   301.000   341.000   408.000  470.00042   6140  
Alicante  7732   274.000   483.000   468.000  280.000...56337  
Valencia  7911   261.000   623.000  1302.000 1487.00057772  
Valencia  7911   163.000   178.000   192.000  127.00058   1082  
Valencia  7739   399.000   528.000   778.000  758.00059   1628  
Valencia  8130   269.000   353.000   396.000  486.00060   1645  
Valencia  7739   848.000  1015.000  1217.000  876.00061   1960  
Valencia  8110   168.000   180.000   205.000  235.00062   2415  
Valencia  7911   221.000   139.000   110.000  184.00063   2416  
Valencia  7911   262.000   265.000   296.000  207.00064   2446  
Valencia  829944.000   193.000   337.000  415.00065   3485  
Valencia  8122   880.000   726.000   774.000 1081.00066   4053  
Valencia  8130   243.000   649.000   880.000  734.00067   5566  
Valencia  8299   325.000   767.00097.000  158.00068   5779  
Valencia  7739   298.000   356.000   344.000  348.00069   6167  
Valencia  7711  2483.000  2461.000  2363.000 1915.000
 bartlett.test(IE.2005~Provincia)
Bartlett test of homogeneity of variances
data:  IE.2005 by ProvinciaBartlett's K-squared = 53.5967, df = 2, p-value = 
2.3e-12 bartlett.test(IE.2007~Provincia)
Bartlett test of homogeneity of variances
data:  IE.2007 by ProvinciaBartlett's K-squared = 28.8007, df = 2, p-value = 
5.572e-07
That's the problem:

resultado-apply(DATOS,2,function(x)(bartlett.test(x~Provincia)))Mensajes de 
aviso perdidos1: In FUN(X[[4L]], ...) : NAs introducidos por coerción2: In 
FUN(X[[4L]], ...) : NAs introducidos por coerción3: In FUN(X[[4L]], ...) : NAs 
introducidos por coerción
  
[[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

2013-07-22 Thread Mª Teresa Martinez Soriano
Hi, I did what you have told me but I can not do it well,
NUMERO Provincia CENAES   IE.2005   IE.2006   IE.2007  IE.2008
29183  Alicante  771142.00046.00055.000   47.00030
479  Alicante  8299  1158.000   476.000   503.000  300.00031591  
Alicante  8129   540.000   764.000  1037.000  938.00032   1429  
Alicante  8219  5233.000  6234.000  4659.000 2212.00033   2681  
Alicante  829917.000 8.00010.0009.00034   3374  
Alicante  8299   346.000   416.000   343.000  330.00035   5341  
Alicante  8299  1198.000  1531.000   235.0000.00036   5772  
Alicante  7732   709.000   689.000   584.000  419.00037   6127  
Alicante  7711   225.000   125.000   175.000   71.00038   6132  
Alicante  7711  1084.000   634.000   592.000  291.00039   6133  
Alicante  7711  5143.000  5838.000  7136.000 7835.00040   6134  
Alicante  7711   327.000   394.000   442.000  331.00041   6138  
Alicante  7739   301.000   341.000   408.000  470.00042   6140  
Alicante  7732   274.000   483.000   468.000  280.000...56337  
Valencia  7911   261.000   623.000  1302.000 1487.00057772  
Valencia  7911   163.000   178.000   192.000  127.00058   1082  
Valencia  7739   399.000   528.000   778.000  758.00059   1628  
Valencia  8130   269.000   353.000   396.000  486.00060   1645  
Valencia  7739   848.000  1015.000  1217.000  876.00061   1960  
Valencia  8110   168.000   180.000   205.000  235.00062   2415  
Valencia  7911   221.000   139.000   110.000  184.00063   2416  
Valencia  7911   262.000   265.000   296.000  207.00064   2446  
Valencia  829944.000   193.000   337.000  415.00065   3485  
Valencia  8122   880.000   726.000   774.000 1081.00066   4053  
Valencia  8130   243.000   649.000   880.000  734.00067   5566  
Valencia  8299   325.000   767.00097.000  158.00068   5779  
Valencia  7739   298.000   356.000   344.000  348.00069   6167  
Valencia  7711  2483.000  2461.000  2363.000 1915.000
This is the code that you have told meresult - vector(list, ncol(datos))for( 
i in 2:ncol(datos) {result [i-1] - bartlett.test(datos[,i]~datos$Provincia))}
This is what I get Error en `[.data.frame`(DATOS, , i) : undefined columns 
selectedAdemás: Mensajes de aviso perdidos1: In result[i - 1] - 
bartlett.test(DATOS[, i] ~ DATOS$Provincia) :  número de items para para 
sustituir no es un múltiplo de la longitud del reemplazo2: In result[i - 1] - 
bartlett.test(DATOS[, i] ~ DATOS$Provincia) :  número de items para para 
sustituir no es un múltiplo de la longitud del reemplazo3: In result[i - 1] - 
bartlett.test(DATOS[, i] ~ DATOS$Provincia) :  número de items para para 
sustituir no es un múltiplo de la longitud del reemplazo4: In result[i - 1] - 
bartlett.test(DATOS[, i] ~ DATOS$Provincia) :  número de items para para 
sustituir no es un múltiplo de la longitud del reemplazo5: In result[i - 1] - 
bartlett.test(DATOS[, i] ~ DATOS$Provincia) :  número de items para para 
sustituir no es un múltiplo de la longitud del reemplazo6: In result[i - 1] - 
bartlett.test(DATOS[, i] ~ DATOS$Provincia) :  número de items para para 
sustituir no es un múltiplo de la longitud del reemplazo7: In result[i - 1] - 
bartlett.test(DATOS[, i] ~ DATOS$Provincia) :  número de items para para 
sustituir no es un múltiplo de la longitud del reemplazo

(Sorry, I have R in Spanish, número de items para para sustituir no es un 
múltiplo de la longitud del reemplazo= number of items to replace is not a 
multiple of replacement length)Thanks in advance
 
[[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] HELP R

2013-07-22 Thread Mª Teresa Martinez Soriano







Hi, I did what you have told me but I can not do it well,
NUMERO Provincia CENAES   IE.2005   IE.2006   IE.2007  IE.2008
29183  Alicante  771142.00046.00055.000   47.00030
479  Alicante  8299  1158.000   476.000   503.000  300.00031591  
Alicante  8129   540.000   764.000  1037.000  938.00032   1429  
Alicante  8219  5233.000  6234.000  4659.000 2212.00033   2681  
Alicante  829917.000 8.00010.0009.00034   3374  
Alicante  8299   346.000   416.000   343.000  330.00035   5341  
Alicante  8299  1198.000  1531.000   235.0000.00036   5772  
Alicante  7732   709.000   689.000   584.000  419.00037   6127  
Alicante  7711   225.000   125.000   175.000   71.00038   6132  
Alicante  7711  1084.000   634.000   592.000  291.00039   6133  
Alicante  7711  5143.000  5838.000  7136.000 7835.00040   6134  
Alicante  7711   327.000   394.000   442.000  331.00041   6138  
Alicante  7739   301.000   341.000   408.000  470.00042   6140  
Alicante  7732   274.000   483.000   468.000  280.000...56337  
Valencia  7911   261.000   623.000  1302.000 1487.00057772  
Valencia  7911   163.000   178.000   192.000  127.00058   1082  
Valencia  7739   399.000   528.000   778.000  758.00059   1628  
Valencia  8130   269.000   353.000   396.000  486.00060   1645  
Valencia  7739   848.000  1015.000  1217.000  876.00061   1960  
Valencia  8110   168.000   180.000   205.000  235.00062   2415  
Valencia  7911   221.000   139.000   110.000  184.00063   2416  
Valencia  7911   262.000   265.000   296.000  207.00064   2446  
Valencia  829944.000   193.000   337.000  415.00065   3485  
Valencia  8122   880.000   726.000   774.000 1081.00066   4053  
Valencia  8130   243.000   649.000   880.000  734.00067   5566  
Valencia  8299   325.000   767.00097.000  158.00068   5779  
Valencia  7739   298.000   356.000   344.000  348.00069   6167  
Valencia  7711  2483.000  2461.000  2363.000 1915.000
This is the code that you have told meresult - vector(list, ncol(datos))for( 
i in 2:ncol(datos) {result [i-1] - bartlett.test(datos[,i]~datos$Provincia))}
This is what I get Error en `[.data.frame`(DATOS, , i) : undefined columns 
selectedAdemás: Mensajes de aviso perdidos1: In result[i - 1] - 
bartlett.test(DATOS[, i] ~ DATOS$Provincia) :  número de items para para 
sustituir no es un múltiplo de la longitud del reemplazo2: In result[i - 1] - 
bartlett.test(DATOS[, i] ~ DATOS$Provincia) :  número de items para para 
sustituir no es un múltiplo de la longitud del reemplazo3: In result[i - 1] - 
bartlett.test(DATOS[, i] ~ DATOS$Provincia) :  número de items para para 
sustituir no es un múltiplo de la longitud del reemplazo4: In result[i - 1] - 
bartlett.test(DATOS[, i] ~ DATOS$Provincia) :  número de items para para 
sustituir no es un múltiplo de la longitud del reemplazo5: In result[i - 1] - 
bartlett.test(DATOS[, i] ~ DATOS$Provincia) :  número de items para para 
sustituir no es un múltiplo de la longitud del reemplazo6: In result[i - 1] - 
bartlett.test(DATOS[, i] ~ DATOS$Provincia) :  número de items para para 
sustituir no es un múltiplo de la longitud del reemplazo7: In result[i - 1] - 
bartlett.test(DATOS[, i] ~ DATOS$Provincia) :  número de items para para 
sustituir no es un múltiplo de la longitud del reemplazo

(Sorry, I have R in Spanish, número de items para para sustituir no es un 
múltiplo de la longitud del reemplazo= number of items to replace is not a 
multiple of replacement length)

SO, I have changed a bit your code : result - vector(list, ncol(datos))for( 
i in 2:ncol(datos)+1) {result [i-1] - 
bartlett.test(datos[,i]~datos$Provincia))}And now R answer is:
Error en model.frame.default(formula = datos[, i] ~ datos ~ Provincia) :  
object is not a matrix.
What can I do? Is it necessary that datos works as a matrix?
Thanks in advance   
  
[[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] problem loading large xlsx file into r

2013-07-22 Thread S N V Krishna
Thanks Jim, I tried XLConnect but faced with same error.

 options(java.parameters = '-Xmx5g')

 library(XLConnect)
Loading required package: rJava
XLConnect 0.2-5 by Mirai Solutions GmbH
http://www.mirai-solutions.com ,
http://miraisolutions.wordpress.com

 cftc = 
 readWorksheetFromFile(d:\\Krishna\\Research\\CFTC_COT\\cftcdata.xlsx, sheet 
 = 'Sheet1')
Error: OutOfMemoryError (Java): Java heap space

What is the maximum file size to load into R? is there a better way to load 
large excel files to R?

Many thanks for the help.

Regards, 

Krishna

-Original Message-
From: Jim Holtman [mailto:jholt...@gmail.com] 
Sent: Monday, July 22, 2013 5:10 PM
To: S N V Krishna
Cc: r-help@r-project.org
Subject: Re: [R] problem loading large xlsx file into r

try the XLConnect package and if possible change the xlsx to xls format 
for better performance.

Sent from my iPad

On Jul 22, 2013, at 1:24, S N V Krishna kris...@primps.com.sg wrote:

 Hi,
 
 I am facing trouble when trying to read large xlsx file into R. please find 
 the code and error below. The file I was trying to read has 36,500 rows X 188 
 col, ~ 37 MB size.
 
 options( java.parameters = -Xmx4g )
 
 library(xlsx)
 Loading required package: xlsxjars
 Loading required package: rJava
 
 cftc = read.xlsx(d:\\Krishna\\Research\\CFTC_COT\\cftcdata.xlsx, 1)
 Error in .jcall(RJavaTools, Ljava/lang/Object;, invokeMethod, cl,  :
  
 
 sessionInfo()
 R version 3.0.1 (2013-05-16)
 Platform: x86_64-w64-mingw32/x64 (64-bit)
 
 locale:
 [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United 
 States.1252 [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C 
 [5] LC_TIME=English_United States.1252
 
 attached base packages:
 [1] stats graphics  grDevices utils datasets  methods   base
 
 other attached packages:
 [1] xlsx_0.5.1 xlsxjars_0.5.0 rJava_0.9-5
 
 Many thanks for the help and guidance.
 
 Regards,
 
 Krishna
 
[[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.


[R] Y label doesn't show up on printing files

2013-07-22 Thread Mohit Dhingra
Hello,

I'm using R version 2.15.1 (2012-06-22) -- Roasted Marshmallows .

System info: Linux ubuntu 3.5.0-36-generic #57~precise1-Ubuntu SMP Thu
Jun 20 18:21:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux.

When I plot something, y label does show up on the pop up image.
plot (x, rtimel[,2] , xlab=Memory Allocated (in MB), ylab=Response
Time (in ms), type=l, col=black, ylim=c(0,m) )

But when I try to save it using
dev.copy(pdf,'response_time_with_memory_direct.pdf')
dev.off()

Y-label doesn't get printed on the pdf file. Can someone please help?



Thanks  Regards
Mohit Dhingra
+919611190435

__
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] HELP R

2013-07-22 Thread PIKAL Petr
Hi

You rather shall stop using HTML mail, it gets scrambled when posting to R help.
Then I believe you will profit from reading an Introduction to R, you seem to 
not knowing what you really do.

result - vector(list,ncol(datos))

initializes result before a loop. If you have some extra columns the size of 
resulting list is not correct. The same apply to following loop.

for( i in 2:ncol(datos) {
result [i-1] - bartlett.test(datos[,i]~datos$Provincia))
}
Error en `[.data.frame`(DATOS, , i) : undefined columns selected

Well, there probably shall be

result [[i-1]] - bartlett.test(datos[,i]~datos$Provincia))

to get rid of the error.

Without data I did not test my code and therefore did not use correct 
assignment. Sorry.

Regards 
Petr

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of Ma Teresa Martinez Soriano
 Sent: Monday, July 22, 2013 11:12 AM
 To: r-help@r-project.org
 Subject: Re: [R] HELP R
 
 
 
 
 
 
 
 
 Hi, I did what you have told me but I can not do it well,
 NUMERO Provincia CENAES   IE.2005   IE.2006   IE.2007  IE.2008
 29183  Alicante  771142.00046.00055.000
 47.00030479  Alicante  8299  1158.000   476.000   503.000
 300.00031591  Alicante  8129   540.000   764.000  1037.000
 938.00032   1429  Alicante  8219  5233.000  6234.000  4659.000
 2212.00033   2681  Alicante  829917.000 8.00010.000
 9.00034   3374  Alicante  8299   346.000   416.000   343.000
 330.00035   5341  Alicante  8299  1198.000  1531.000   235.000
 0.00036   5772  Alicante  7732   709.000   689.000   584.000
 419.00037   6127  Alicante  7711   225.000   125.000   175.000
 71.00038   6132  Alicante  7711  1084.000   634.000   592.000
 291.00039   6133  Alicante  7711  5143.000  5838.000  7136.000
 7835.00040   6134  Alicante  7711   327.000   394.000   442.000
 331.00041   6138  Alicante  7739   301.000   341.000   408.000
 470.00042   6140  Alicante  7732   274.000   483.000   468.000
 280.000...56337  Valencia  7911   261.000   623.000
 1302.000 1487.00057772  Valencia  7911   163.000   178.000
 192.000  127.00058   1082  Valencia  7739   399.000   528.000
 778.000  758.00059   1628  Valencia  8130   269.000   353.000
 396.000  486.00060   1645  Valencia  7739   848.000  1015.000
 1217.000  876.00061   1960  Valencia  8110   168.000   180.000
 205.000  235.00062   2415  Valencia  7911   221.000   139.000
 110.000  184.00063   2416  Valencia  7911   262.000   265.000
 296.000  207.00064   2446  Valencia  829944.000   193.000
 337.000  415.00065   3485  Valencia  8122   880.000   726.000
 774.000 1081.00066   4053  Valencia  8130   243.000   649.000
 880.000  734.00067   5566  Valencia  8299   325.000   767.000
 97.000  158.00068   5779  Valencia  7739   298.000   356.000
 344.000  348.00069   6167  Valencia  7711  2483.000  2461.000
 2363.000 1915.000
 This is the code that you have told meresult - vector(list,
 ncol(datos))for( i in 2:ncol(datos) {result [i-1] -
 bartlett.test(datos[,i]~datos$Provincia))}
 This is what I get Error en `[.data.frame`(DATOS, , i) : undefined
 columns selectedAdemás: Mensajes de aviso perdidos1: In result[i - 1]
 - bartlett.test(DATOS[, i] ~ DATOS$Provincia) :  número de items para
 para sustituir no es un múltiplo de la longitud del reemplazo2: In
 result[i - 1] - bartlett.test(DATOS[, i] ~ DATOS$Provincia) :  número
 de items para para sustituir no es un múltiplo de la longitud del
 reemplazo3: In result[i - 1] - bartlett.test(DATOS[, i] ~
 DATOS$Provincia) :  número de items para para sustituir no es un
 múltiplo de la longitud del reemplazo4: In result[i - 1] -
 bartlett.test(DATOS[, i] ~ DATOS$Provincia) :  número de items para
 para sustituir no es un múltiplo de la longitud del reemplazo5: In
 result[i - 1] - bartlett.test(DATOS[, i] ~ DATOS$Provincia) :  número
 de items para para sustituir no es un múltiplo de la longitud del
 reemplazo6: In result[i - 1] - bartlett.test(DATOS[, i] ~
 DATOS$Provincia) :  número de items para para sustituir no es un
 múltiplo de la longitud del reemplazo7: In result[i - 1] -
 bartlett.test(DATOS[, i] ~ DATOS$Provincia) :  número de items para
 para sustituir no es un múltiplo de la longitud del reemplazo
 
 (Sorry, I have R in Spanish, número de items para para sustituir no es
 un múltiplo de la longitud del reemplazo= number of items to replace is
 not a multiple of replacement length)
 
 SO, I have changed a bit your code : result - vector(list,
 ncol(datos))for( i in 2:ncol(datos)+1) {result [i-1] -
 bartlett.test(datos[,i]~datos$Provincia))}And now R answer is:
 Error en model.frame.default(formula = datos[, i] ~ datos ~ Provincia)
 :  object is not a matrix.
 What can I do? Is it necessary that datos works 

Re: [R] problem loading large xlsx file into r

2013-07-22 Thread Jim Holtman
did you try converting xlsx to xls (if possible).  the xlsx format puts a large 
demand on both memory and cpu resources.

Sent from my iPad

On Jul 22, 2013, at 6:09, S N V Krishna kris...@primps.com.sg wrote:

 Thanks Jim, I tried XLConnect but faced with same error.
 
 options(java.parameters = '-Xmx5g')
 
 library(XLConnect)
 Loading required package: rJava
 XLConnect 0.2-5 by Mirai Solutions GmbH
 http://www.mirai-solutions.com ,
 http://miraisolutions.wordpress.com
 
 cftc = 
 readWorksheetFromFile(d:\\Krishna\\Research\\CFTC_COT\\cftcdata.xlsx, 
 sheet = 'Sheet1')
 Error: OutOfMemoryError (Java): Java heap space
 
 What is the maximum file size to load into R? is there a better way to load 
 large excel files to R?
 
 Many thanks for the help.
 
 Regards, 
 
 Krishna
 
 -Original Message-
 From: Jim Holtman [mailto:jholt...@gmail.com] 
 Sent: Monday, July 22, 2013 5:10 PM
 To: S N V Krishna
 Cc: r-help@r-project.org
 Subject: Re: [R] problem loading large xlsx file into r
 
 try the XLConnect package and if possible change the xlsx to xls format 
 for better performance.
 
 Sent from my iPad
 
 On Jul 22, 2013, at 1:24, S N V Krishna kris...@primps.com.sg wrote:
 
 Hi,
 
 I am facing trouble when trying to read large xlsx file into R. please find 
 the code and error below. The file I was trying to read has 36,500 rows X 
 188 col, ~ 37 MB size.
 
 options( java.parameters = -Xmx4g )
 
 library(xlsx)
 Loading required package: xlsxjars
 Loading required package: rJava
 
 cftc = read.xlsx(d:\\Krishna\\Research\\CFTC_COT\\cftcdata.xlsx, 1)
 Error in .jcall(RJavaTools, Ljava/lang/Object;, invokeMethod, cl,  :
 
 
 sessionInfo()
 R version 3.0.1 (2013-05-16)
 Platform: x86_64-w64-mingw32/x64 (64-bit)
 
 locale:
 [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United 
 States.1252 [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C 
 [5] LC_TIME=English_United States.1252
 
 attached base packages:
 [1] stats graphics  grDevices utils datasets  methods   base
 
 other attached packages:
 [1] xlsx_0.5.1 xlsxjars_0.5.0 rJava_0.9-5
 
 Many thanks for the help and guidance.
 
 Regards,
 
 Krishna
 
   [[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] Select csv files by choosing datetime

2013-07-22 Thread Jim Holtman
you can use 'file.info' to get the date the file was created and then choose 
the file you want.

Sent from my iPad

On Jul 22, 2013, at 4:36, R_Antony antony.akk...@ge.com wrote:

 Hi,
 
 how can we read particular files from a path ? - i mean, i need to read csv
 files which is created between two date and time. Here i need to get
 filename along with path.
 
 Thanks,
 Antony.
 
 
 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Select-csv-files-by-choosing-datetime-tp4672023.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 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] about mix type clust algorithm

2013-07-22 Thread Jose Iparraguirre
Dear Cheng,

This question exceeds the topics of this group. However, you may benefit from 
this recent (and excellent) paper along with the discussions:

Henning, C. and T. Liao (2013). How to find an appropriate clustering for 
mixed-type variables with application to socio-economy stratification, Journal 
of Applied Statistics, Vol. 62, Part 3, pp. 309-369.

Regards,

José

Prof. José Iparraguirre
Chief Economist
Age UK

Profesor de Economía
Universidad de Morón
Morón, Buenos Aires, Argentina


-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Cheng, Yi
Sent: 22 July 2013 07:23
To: r-help@r-project.org
Subject: [R] about mix type clust algorithm

Hi:
I have tried to find the appropriate clust algorithm for mixed type of data.
The suggested way I see is:

1.   use daisy to get the dissimilarity matrix

2.   use PAM/hclust by providing the dissimilarity matrix, to get the 
clusters
but by following this, when the data set grows bigger say 10,000 rows of data, 
the dissimilarity matrix will be O(n^2), and out of memory will occur.
I am wondering is there any better ways to do the mixed type cluster?

Cheng Yi


[[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.

The Wireless from Age UK | Radio for grown-ups.

www.ageuk.org.uk/thewireless


If you’re looking for a radio station that offers real variety, tune in to The 
Wireless from Age UK. 
Whether you choose to listen through the website at 
www.ageuk.org.uk/thewireless, on digital radio (currently available in London 
and Yorkshire) or through our TuneIn Radio app, you can look forward to an 
inspiring mix of music, conversation and useful information 24 hours a day.



 
---
Age UK is a registered charity and company limited by guarantee, (registered 
charity number 1128267, registered company number 6825798). 
Registered office: Tavis House, 1-6 Tavistock Square, London WC1H 9NA.

For the purposes of promoting Age UK Insurance, Age UK is an Appointed 
Representative of Age UK Enterprises Limited, Age UK is an Introducer 
Appointed Representative of JLT Benefit Solutions Limited and Simplyhealth 
Access for the purposes of introducing potential annuity and health 
cash plans customers respectively.  Age UK Enterprises Limited, JLT Benefit 
Solutions Limited and Simplyhealth Access are all authorised and 
regulated by the Financial Services Authority. 
--

This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are 
addressed. If you receive a message in error, please advise the sender and 
delete immediately.

Except where this email is sent in the usual course of our business, any 
opinions expressed in this email are those of the author and do not 
necessarily reflect the opinions of Age UK or its subsidiaries and associated 
companies. Age UK monitors all e-mail transmissions passing 
through its network and may block or modify mails which are deemed to be 
unsuitable.

Age Concern England (charity number 261794) and Help the Aged (charity number 
272786) and their trading and other associated companies merged 
on 1st April 2009.  Together they have formed the Age UK Group, dedicated to 
improving the lives of people in later life.  The three national 
Age Concerns in Scotland, Northern Ireland and Wales have also merged with Help 
the Aged in these nations to form three registered charities: 
Age Scotland, Age NI, Age Cymru.




__
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] 2sls and systemfit

2013-07-22 Thread Cecilia Carmo
I have the following model:
Cost of debt = intercept + information quality + control variable1 + control 
variable2 + … + error term

I want to perform 2sls because I think I could have two situations:
First: maybe information quality is correlated with the error term (because of 
omitted variables)
Second: maybe information quality depends on the cost of debt like this:
information quality = intercept + Cost of debt + control variable1 + control 
variable2 + … + error term

I have some variables (instruments) for information quality.
Now I need to know how to use systemfit with this information in each of those 
situations.

Thank you,
Cecília Carmo,
Portugal

[[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] HELP R

2013-07-22 Thread John Kane
Everything is a mess. Please don't post in HTML. The list removes all 
formatting and sends it as text.
Have a look at these links for some suggestions on how to ask a question here.
https://github.com/hadley/devtools/wiki/Reproducibility
 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

John Kane
Kingston ON Canada


 -Original Message-
 From: teresama...@hotmail.com
 Sent: Mon, 22 Jul 2013 09:11:32 +
 To: r-help@r-project.org
 Subject: Re: [R] HELP R
 
 
 
 
 
 
 
 
 Hi, I did what you have told me but I can not do it well,
 NUMERO Provincia CENAES   IE.2005   IE.2006   IE.2007  IE.2008
 29183  Alicante  771142.00046.00055.000
 47.00030479  Alicante  8299  1158.000   476.000   503.000
 300.00031591  Alicante  8129   540.000   764.000  1037.000
 938.00032   1429  Alicante  8219  5233.000  6234.000  4659.000
 2212.00033   2681  Alicante  829917.000 8.00010.000
 9.00034   3374  Alicante  8299   346.000   416.000   343.000
 330.00035   5341  Alicante  8299  1198.000  1531.000   235.000
 0.00036   5772  Alicante  7732   709.000   689.000   584.000
 419.00037   6127  Alicante  7711   225.000   125.000   175.000
 71.00038   6132  Alicante  7711  1084.000   634.000   592.000
 291.00039   6133  Alicante  7711  5143.000  5838.000  7136.000
 7835.00040   6134  Alicante  7711   327.000   394.000   442.000
 331.00041   6138  Alicante  7739   301.000   341.000   408.000
 470.00042   6140  Alicante  7732   274.000   483.000   468.000
 280.000...56337  Valencia  7911   261.000   623.000  1302.000
 1487.00057772  Valencia  7911   163.000   178.000   192.000
 127.00058   1082  Valencia  7739   399.000   528.000   778.000
 758.00059   1628  Valencia  8130   269.000   353.000   396.000
 486.00060   1645  Valencia  7739   848.000  1015.000  1217.000
 876.00061   1960  Valencia  8110   168.000   180.000   205.000
 235.00062   2415  Valencia  7911   221.000   139.000   110.000
 184.00063   2416  Valencia  7911   262.000   265.000   296.000
 207.00064   2446  Valencia  829944.000   193.000   337.000
 415.00065   3485  Valencia  8122   880.000   726.000   774.000
 1081.00066   4053  Valencia  8130   243.000   649.000   880.000
 734.00067   5566  Valencia  8299   325.000   767.00097.000
 158.00068   5779  Valencia  7739   298.000   356.000   344.000
 348.00069   6167  Valencia  7711  2483.000  2461.000  2363.000
 1915.000
 This is the code that you have told meresult - vector(list,
 ncol(datos))for( i in 2:ncol(datos) {result [i-1] -
 bartlett.test(datos[,i]~datos$Provincia))}
 This is what I get Error en `[.data.frame`(DATOS, , i) : undefined
 columns selectedAdemas: Mensajes de aviso perdidos1: In result[i - 1] -
 bartlett.test(DATOS[, i] ~ DATOS$Provincia) :  nzmero de items para para
 sustituir no es un mzltiplo de la longitud del reemplazo2: In result[i -
 1] - bartlett.test(DATOS[, i] ~ DATOS$Provincia) :  nzmero de items para
 para sustituir no es un mzltiplo de la longitud del reemplazo3: In
 result[i - 1] - bartlett.test(DATOS[, i] ~ DATOS$Provincia) :  nzmero de
 items para para sustituir no es un mzltiplo de la longitud del
 reemplazo4: In result[i - 1] - bartlett.test(DATOS[, i] ~
 DATOS$Provincia) :  nzmero de items para para sustituir no es un mzltiplo
 de la longitud del reemplazo5: In result[i - 1] - bartlett.test(DATOS[,
 i] ~ DATOS$Provincia) :  nzmero de items para para sustituir no es un
 mzltiplo de la longitud del reemplazo6: In result[i - 1] -
 bartlett.test(DATOS[, i] ~ DATOS$Provincia) :  nzmero de items para para
 sustituir no es un mzltiplo de la longitud del reemplazo7: In result[i -
 1] - bartlett.test(DATOS[, i] ~ DATOS$Provincia) :  nzmero de items para
 para sustituir no es un mzltiplo de la longitud del reemplazo
 
 (Sorry, I have R in Spanish, nzmero de items para para sustituir no es un
 mzltiplo de la longitud del reemplazo= number of items to replace is not
 a multiple of replacement length)
 
 SO, I have changed a bit your code : result - vector(list,
 ncol(datos))for( i in 2:ncol(datos)+1) {result [i-1] -
 bartlett.test(datos[,i]~datos$Provincia))}And now R answer is:
 Error en model.frame.default(formula = datos[, i] ~ datos ~ Provincia) :
 object is not a matrix.
 What can I do? Is it necessary that datos works as a matrix?
 Thanks in advance
   [[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.


FREE ONLINE PHOTOSHARING - Share your photos 

Re: [R] Calculate interaction for a big dataframe

2013-07-22 Thread PIKAL Petr
Hi

you maybe could use paste

 f1-sample(letters[1:3], 10, replace=T)
 f2-sample(letters[4:7], 10, replace=T)
 f3-sample(letters[9:11], 10, replace=T)
 interaction(f1, f2, f3, drop=T)
 [1] c.e.j b.e.j a.e.j c.g.i a.f.j b.g.k a.e.i a.e.k a.d.j b.e.j
Levels: a.e.i c.g.i a.d.j a.e.j b.e.j c.e.j a.f.j a.e.k b.g.k
 paste(f1, f2, f3, sep=.)
 [1] c.e.j b.e.j a.e.j c.g.i a.f.j b.g.k a.e.i a.e.k a.d.j
[10] b.e.j

The difference is that interaction gives you directly factor, paste gives you 
character vector, but it may be convenient too for your purpose.

Regards
Petr


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of Arnaud Michel
 Sent: Monday, July 22, 2013 10:57 AM
 To: R help
 Subject: [R] Calculate interaction for a big dataframe
 
 Hi
 
 To calculate the value of the interaction between factors of a
 dataframe df, does exist any function which could replace the function
 when the dataframe df has the numbers of rows of df is large (~55000)
 and also the numbers of combinaison of the three factors is large. The
 calcul abort.
 The function to calculate the interaction is :
 as.numeric(interaction(df [,c(1:3)],drop=TRUE))
 
 To complete the question and to calculate interaction beetween 3
 factors f1, f2, f3, does it possible to calculate first f12 =
 interaction
 (f1,f2) and after calculate interaction (f12, f3).
 It seems to me that yes.
 
 Thanks for your help
 
 
 
 
 --
 Michel ARNAUD
 Chargé de mission auprès du DRH
 DGDRD-Drh - TA 174/04
 Av Agropolis 34398 Montpellier cedex 5
 tel : 04.67.61.75.38
 fax : 04.67.61.57.87
 port: 06.47.43.55.31
 
 __
 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] about mix type clust algorithm

2013-07-22 Thread Brian Smith
Thanks for the article, Jose! It looks very interesting.


On Mon, Jul 22, 2013 at 7:12 AM, Jose Iparraguirre 
jose.iparragui...@ageuk.org.uk wrote:

 Dear Cheng,

 This question exceeds the topics of this group. However, you may benefit
 from this recent (and excellent) paper along with the discussions:

 Henning, C. and T. Liao (2013). How to find an appropriate clustering for
 mixed-type variables with application to socio-economy stratification,
 Journal of Applied Statistics, Vol. 62, Part 3, pp. 309-369.

 Regards,

 José

 Prof. José Iparraguirre
 Chief Economist
 Age UK

 Profesor de Economía
 Universidad de Morón
 Morón, Buenos Aires, Argentina


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
 On Behalf Of Cheng, Yi
 Sent: 22 July 2013 07:23
 To: r-help@r-project.org
 Subject: [R] about mix type clust algorithm

 Hi:
 I have tried to find the appropriate clust algorithm for mixed type of
 data.
 The suggested way I see is:

 1.   use daisy to get the dissimilarity matrix

 2.   use PAM/hclust by providing the dissimilarity matrix, to get the
 clusters
 but by following this, when the data set grows bigger say 10,000 rows of
 data, the dissimilarity matrix will be O(n^2), and out of memory will occur.
 I am wondering is there any better ways to do the mixed type cluster?

 Cheng Yi


 [[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.

 The Wireless from Age UK | Radio for grown-ups.

 www.ageuk.org.uk/thewireless


 If you’re looking for a radio station that offers real variety, tune in to
 The Wireless from Age UK.
 Whether you choose to listen through the website at
 www.ageuk.org.uk/thewireless, on digital radio (currently available in
 London and Yorkshire) or through our TuneIn Radio app, you can look forward
 to an inspiring mix of music, conversation and useful information 24 hours
 a day.




 ---
 Age UK is a registered charity and company limited by guarantee,
 (registered charity number 1128267, registered company number 6825798).
 Registered office: Tavis House, 1-6 Tavistock Square, London WC1H 9NA.

 For the purposes of promoting Age UK Insurance, Age UK is an Appointed
 Representative of Age UK Enterprises Limited, Age UK is an Introducer
 Appointed Representative of JLT Benefit Solutions Limited and Simplyhealth
 Access for the purposes of introducing potential annuity and health
 cash plans customers respectively.  Age UK Enterprises Limited, JLT
 Benefit Solutions Limited and Simplyhealth Access are all authorised and
 regulated by the Financial Services Authority.
 --

 This email and any files transmitted with it are confidential and intended
 solely for the use of the individual or entity to whom they are
 addressed. If you receive a message in error, please advise the sender and
 delete immediately.

 Except where this email is sent in the usual course of our business, any
 opinions expressed in this email are those of the author and do not
 necessarily reflect the opinions of Age UK or its subsidiaries and
 associated companies. Age UK monitors all e-mail transmissions passing
 through its network and may block or modify mails which are deemed to be
 unsuitable.

 Age Concern England (charity number 261794) and Help the Aged (charity
 number 272786) and their trading and other associated companies merged
 on 1st April 2009.  Together they have formed the Age UK Group, dedicated
 to improving the lives of people in later life.  The three national
 Age Concerns in Scotland, Northern Ireland and Wales have also merged with
 Help the Aged in these nations to form three registered charities:
 Age Scotland, Age NI, Age Cymru.




 __
 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.


[R] Why does impulse response function of VAR starts at zero and not at one?

2013-07-22 Thread José Verhoeven
Hi there,
I have estimated a bivariate VAR model (with series x1 and x2 as endogenous
variables):

y=cbind(x1,x2)
z=cbind(d1,d2,d3,d4,d5,d6,d7,d8,d9)   # some dummy variables

model-VAR(y, p = 3, type = c(const, trend, both, none),
season = NULL, exogen = z, lag.max = NULL,
ic = c(AIC, HQ, SC, FPE))

and I have plotted the cumulative impulse response function with:

impulseresponse-irf(lagmodel, impulse = x2, response = x1, n.ahead =
400,
ortho = TRUE, cumulative = TRUE, boot = FALSE)
plot(impulseresponse)

Now as the impulse response function shows the effect on e.g. x1 of a unit
shock in x2 I expect the value at t=0 to be at or around one (depending on
whether there is an interscept in the model). Why then, does all impulse
response plots I get start at zero?

I really hope someone can help me out! Thanks in advance.

Jose

[[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] How to split two levels several times?

2013-07-22 Thread Rui Barradas

Hello,

Sorry, I've just realized that your data frame is named 'XXX', not 
'dat'. Change that and the rest should work:



idx - cumsum(c(TRUE, diff(XXX$electrode == electrode1)  0))
split(XXX, idx)


Rui Barradas

Em 22-07-2013 16:47, Rui Barradas escreveu:

Hello,

Try the following.


idx - cumsum(c(TRUE, diff(dat$electrode == electrode1)  0))
split(dat, idx)


Hope this helps,

Rui Barradas

Em 22-07-2013 15:09, dennis1...@gmx.net escreveu:

Hi,

I have a small problem with the function split() and would appreciate
your help.

I have a table called “XXX” with 2 columns and 49 rows. The 49 rows
belong to 8 different levels (electrode1, ...,electrode8). I want to
split the table always at the row where “electrode1” starts again so
that I can export 7  individual dataframes (numbered “dataframe1” to
”dataframe7”) which contain always electrode1 as first level (always
three rows) with the varying number of rows for electrodes2-8 below.
I tried the split function with various setups:

t - as.factor(XXX$electrode)

dataframeX - split(XXX, f=(levels=t))

But this doesn’t work. Could you please help. Thank you! Dennis


This is the table XXX

electrodelength

electrode15.7
electrode16.3
electrode16.2
electrode211.4
electrode29.7
electrode15.7
electrode16.3
electrode16.2
electrode314.2
electrode314.8
electrode312.6
electrode15.7
electrode16.3
electrode16.2
electrode417.0
electrode416.3
electrode417.8
electrode418.3
electrode416.9
electrode418.5
electrode1

electrode5

electrode1
electrode6
electrode1
electrode7
electrode1
electrode8

__
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.


__
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] Calculate interaction for a big dataframe

2013-07-22 Thread arun
Hi,
You could try:
 cumsum(c(1,abs(diff(as.numeric(factor(v1))
# [1] 1 1 1 2 2 3 3 3 3 4
A.K.




- Original Message -
From: Arnaud Michel michel.arn...@cirad.fr
To: PIKAL Petr petr.pi...@precheza.cz
Cc: R help r-help@r-project.org
Sent: Monday, July 22, 2013 11:41 AM
Subject: Re: [R] Calculate interaction for a big dataframe

Thank you Petr
paste is better than interaction for long vectors
But now a new problem/question is appeared.
Now, I would like transform the vector
v1 - c(
4162.France, 4162.France, 4162.France,
4162.Mali, 4162.Mali,
4162.France, 4162.France, 4162.France, 4162.France,
4162.Mali)
into a vector V2 with the same length but with number which are creasing
v2 - c(1,     1,    1,
2, 2,
3, 3,3,3,
4))

Any idea (function) ?
Regards


Le 22/07/2013 14:45, PIKAL Petr a écrit :
 Hi

 you maybe could use paste

 f1-sample(letters[1:3], 10, replace=T)
 f2-sample(letters[4:7], 10, replace=T)
 f3-sample(letters[9:11], 10, replace=T)
 interaction(f1, f2, f3, drop=T)
   [1] c.e.j b.e.j a.e.j c.g.i a.f.j b.g.k a.e.i a.e.k a.d.j b.e.j
 Levels: a.e.i c.g.i a.d.j a.e.j b.e.j c.e.j a.f.j a.e.k b.g.k
 paste(f1, f2, f3, sep=.)
   [1] c.e.j b.e.j a.e.j c.g.i a.f.j b.g.k a.e.i a.e.k a.d.j
 [10] b.e.j

 The difference is that interaction gives you directly factor, paste gives you 
 character vector, but it may be convenient too for your purpose.

 Regards
 Petr


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of Arnaud Michel
 Sent: Monday, July 22, 2013 10:57 AM
 To: R help
 Subject: [R] Calculate interaction for a big dataframe

 Hi

 To calculate the value of the interaction between factors of a
 dataframe df, does exist any function which could replace the function
 when the dataframe df has the numbers of rows of df is large (~55000)
 and also the numbers of combinaison of the three factors is large. The
 calcul abort.
 The function to calculate the interaction is :
 as.numeric(interaction(df [,c(1:3)],drop=TRUE))

 To complete the question and to calculate interaction beetween 3
 factors f1, f2, f3, does it possible to calculate first f12 =
 interaction
 (f1,f2) and after calculate interaction (f12, f3).
 It seems to me that yes.

 Thanks for your help




 --
 Michel ARNAUD
 Chargé de mission auprès du DRH
 DGDRD-Drh - TA 174/04
 Av Agropolis 34398 Montpellier cedex 5
 tel : 04.67.61.75.38
 fax : 04.67.61.57.87
 port: 06.47.43.55.31

 __
 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.

-- 
Michel ARNAUD
Chargé de mission auprès du DRH
DGDRD-Drh - TA 174/04
Av Agropolis 34398 Montpellier cedex 5
tel : 04.67.61.75.38
fax : 04.67.61.57.87
port: 06.47.43.55.31

__
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] kandell

2013-07-22 Thread Sarah Goslee
Hi,

It's entirely possible you want the Kendall package, which you can
install from CRAN in the way you'd install any package (see
?install.packages for more), but searching for

kendall climate trend

at www.rseek.org suggests various other possibilities.

Sarah

On Mon, Jul 22, 2013 at 10:44 AM, Said Filahi sa.fil...@gmail.com wrote:
 hello,
 I want to use kendall to calculate climate trends. I want to know how to
 install this software on R

 Thanks


-- 
Sarah Goslee
http://www.functionaldiversity.org

__
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] Saving multiple rda-files as one rda-file

2013-07-22 Thread Dark
Hi all,

For a project we have to process some very large CSV files (up to 40 gig)
To reduce them in size and increase operating performance I wanted to store
them as RData files.
Since it was to big I decided to split the csv and saving those parts as
separate .RDA files.
So far so good. Now I want to bind them all together to save as one RDA file
again and this is supprisingly difficult.

First I load my rda files into my environment:
load(paste(rdaoutputdir, file1.rda, sep=))
load(paste(rdaoutputdir, file2.rda, sep=))
load(paste(rdaoutputdir, file3.rda, sep=))
etc

Then I try to combine them into one object.

Using rbind like this gives memory allocation problems ('Error: cannot
allocate vector of size')
objectToSave - rbind(object1, object2, object3)

using pre-allocation gives me a factor level error. I used this code:
nextrow - nrow(object1)+1
object1[nextrow:(nextrow+nrow(object2)-1),] - object2
# we need to assure unique row names
row.names(object1) = 1:nrow(object1)
rm(object2)
gc()

15! warning messages:
1: In `[-.factor`(`*tmp*`, iseq, value = structure(c(1L,  ... :
  invalid factor level, NA generated
2: In `[-.factor`(`*tmp*`, iseq, value = structure(c(1L,  ... :
  invalid factor level, NA generated

What can I do?

Regards Derk



--
View this message in context: 
http://r.789695.n4.nabble.com/Saving-multiple-rda-files-as-one-rda-file-tp4672041.html
Sent from the R help mailing list archive at Nabble.com.

__
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] kandell

2013-07-22 Thread Said Filahi
hello,
I want to use kendall to calculate climate trends. I want to know how to
install this software on R

Thanks

[[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] How to split two levels several times?

2013-07-22 Thread Rui Barradas

Hello,

Try the following.


idx - cumsum(c(TRUE, diff(dat$electrode == electrode1)  0))
split(dat, idx)


Hope this helps,

Rui Barradas

Em 22-07-2013 15:09, dennis1...@gmx.net escreveu:

Hi,

I have a small problem with the function split() and would appreciate your help.

I have a table called “XXX” with 2 columns and 49 rows. The 49 rows belong to 8 
different levels (electrode1, ...,electrode8). I want to split the table always 
at the row where “electrode1” starts again so that I can export 7  individual 
dataframes (numbered “dataframe1” to ”dataframe7”) which contain always 
electrode1 as first level (always three rows) with the varying number of rows 
for electrodes2-8 below.
I tried the split function with various setups:

t - as.factor(XXX$electrode)

dataframeX - split(XXX, f=(levels=t))

But this doesn’t work. Could you please help. Thank you! Dennis


This is the table XXX

electrode   length

electrode1  5.7
electrode1  6.3
electrode1  6.2
electrode2  11.4
electrode2  9.7
electrode1  5.7
electrode1  6.3
electrode1  6.2
electrode3  14.2
electrode3  14.8
electrode3  12.6
electrode1  5.7
electrode1  6.3
electrode1  6.2
electrode4  17.0
electrode4  16.3
electrode4  17.8
electrode4  18.3
electrode4  16.9
electrode4  18.5
electrode1  

electrode5  

electrode1  
electrode6  
electrode1  
electrode7  
electrode1  
electrode8  

__
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] Calculate interaction for a big dataframe

2013-07-22 Thread Arnaud Michel

Thank you Petr
paste is better than interaction for long vectors
But now a new problem/question is appeared.
Now, I would like transform the vector
v1 - c(
4162.France, 4162.France, 4162.France,
4162.Mali, 4162.Mali,
4162.France, 4162.France, 4162.France, 4162.France,
4162.Mali)
into a vector V2 with the same length but with number which are creasing
v2 - c(1, 1,1,
2, 2,
3, 3,3,3,
4))

Any idea (function) ?
Regards


Le 22/07/2013 14:45, PIKAL Petr a écrit :

Hi

you maybe could use paste


f1-sample(letters[1:3], 10, replace=T)
f2-sample(letters[4:7], 10, replace=T)
f3-sample(letters[9:11], 10, replace=T)
interaction(f1, f2, f3, drop=T)

  [1] c.e.j b.e.j a.e.j c.g.i a.f.j b.g.k a.e.i a.e.k a.d.j b.e.j
Levels: a.e.i c.g.i a.d.j a.e.j b.e.j c.e.j a.f.j a.e.k b.g.k

paste(f1, f2, f3, sep=.)

  [1] c.e.j b.e.j a.e.j c.g.i a.f.j b.g.k a.e.i a.e.k a.d.j
[10] b.e.j

The difference is that interaction gives you directly factor, paste gives you 
character vector, but it may be convenient too for your purpose.

Regards
Petr



-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of Arnaud Michel
Sent: Monday, July 22, 2013 10:57 AM
To: R help
Subject: [R] Calculate interaction for a big dataframe

Hi

To calculate the value of the interaction between factors of a
dataframe df, does exist any function which could replace the function
when the dataframe df has the numbers of rows of df is large (~55000)
and also the numbers of combinaison of the three factors is large. The
calcul abort.
The function to calculate the interaction is :
as.numeric(interaction(df [,c(1:3)],drop=TRUE))

To complete the question and to calculate interaction beetween 3
factors f1, f2, f3, does it possible to calculate first f12 =
interaction
(f1,f2) and after calculate interaction (f12, f3).
It seems to me that yes.

Thanks for your help




--
Michel ARNAUD
Chargé de mission auprès du DRH
DGDRD-Drh - TA 174/04
Av Agropolis 34398 Montpellier cedex 5
tel : 04.67.61.75.38
fax : 04.67.61.57.87
port: 06.47.43.55.31

__
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.


--
Michel ARNAUD
Chargé de mission auprès du DRH
DGDRD-Drh - TA 174/04
Av Agropolis 34398 Montpellier cedex 5
tel : 04.67.61.75.38
fax : 04.67.61.57.87
port: 06.47.43.55.31

__
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 split two levels several times?

2013-07-22 Thread dennis1991
Hi,

I have a small problem with the function split() and would appreciate your help.

I have a table called “XXX” with 2 columns and 49 rows. The 49 rows belong to 8 
different levels (electrode1, ...,electrode8). I want to split the table always 
at the row where “electrode1” starts again so that I can export 7  individual 
dataframes (numbered “dataframe1” to ”dataframe7”) which contain always 
electrode1 as first level (always three rows) with the varying number of rows 
for electrodes2-8 below.
I tried the split function with various setups:

t - as.factor(XXX$electrode)

dataframeX - split(XXX, f=(levels=t))

But this doesn’t work. Could you please help. Thank you! Dennis


This is the table XXX

electrode   length

electrode1  5.7
electrode1  6.3
electrode1  6.2
electrode2  11.4
electrode2  9.7
electrode1  5.7
electrode1  6.3
electrode1  6.2
electrode3  14.2
electrode3  14.8
electrode3  12.6
electrode1  5.7
electrode1  6.3
electrode1  6.2
electrode4  17.0
electrode4  16.3
electrode4  17.8
electrode4  18.3
electrode4  16.9
electrode4  18.5
electrode1  

electrode5  

electrode1  
electrode6  
electrode1  
electrode7  
electrode1  
electrode8  

__
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] How to split two levels several times?

2013-07-22 Thread arun
May be this helps:


 split(XXX,cumsum(c(TRUE,diff(as.numeric(XXX$electrode))0)))
A.K.



- Original Message -
From: dennis1...@gmx.net dennis1...@gmx.net
To: r-help@r-project.org
Cc: 
Sent: Monday, July 22, 2013 10:09 AM
Subject: [R] How to split two levels several times?

Hi,

I have a small problem with the function split() and would appreciate your help.

I have a table called “XXX” with 2 columns and 49 rows. The 49 rows belong to 8 
different levels (electrode1, ...,electrode8). I want to split the table always 
at the row where “electrode1” starts again so that I can export 7  individual 
dataframes (numbered “dataframe1” to ”dataframe7”) which contain always 
electrode1 as first level (always three rows) with the varying number of rows 
for electrodes2-8 below.
I tried the split function with various setups:

t - as.factor(XXX$electrode)

dataframeX - split(XXX, f=(levels=t))

But this doesn’t work. Could you please help. Thank you! Dennis


This is the table XXX

electrode    length

electrode1    5.7
electrode1    6.3
electrode1    6.2
electrode2    11.4
electrode2    9.7
electrode1    5.7
electrode1    6.3
electrode1    6.2
electrode3    14.2
electrode3    14.8
electrode3    12.6
electrode1    5.7
electrode1    6.3
electrode1    6.2
electrode4    17.0
electrode4    16.3
electrode4    17.8
electrode4    18.3
electrode4    16.9
electrode4    18.5
electrode1    
        
electrode5    
        
electrode1    
electrode6    
electrode1    
electrode7    
electrode1    
electrode8    

__
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.


[R] fail to install shiny package in R 3.0.1 on Ubuntu

2013-07-22 Thread yu ge
Hello there,


I have been used shiny package on Windows without any problem. Recently I
switched to Linux OS(Ubuntu 12.04), and installed the latest R version
3.0.1. But I couldn't install shiny for some reasons. Here are the error
message:

** preparing package for lazy loading
Error : package ‘codetools’ was built before R 3.0.0: please re-install it
Error : unable to load R code in package ‘Rcpp’
ERROR: lazy loading failed for package ‘Rcpp’
* removing ‘/home/alex/R/x86_64-pc-linux-gnu-library/3.0/Rcpp’
ERROR: dependency ‘Rcpp’ is not available for package ‘httpuv’
* removing ‘/home/alex/R/x86_64-pc-linux-gnu-library/3.0/httpuv’
ERROR: dependency ‘httpuv’ is not available for package ‘shiny’
* removing ‘/home/alex/R/x86_64-pc-linux-gnu-library/3.0/shiny’

The downloaded source packages are in
‘/tmp/RtmpA7KumO/downloaded_packages’
Warning messages:
1: In install.packages(shiny) :
  installation of package ‘Rcpp’ had non-zero exit status
2: In install.packages(shiny) :
  installation of package ‘httpuv’ had non-zero exit status
3: In install.packages(shiny) :
  installation of package ‘shiny’ had non-zero exit status


I am newbee for Linux OS. Do I need to install an early R version(older
than 3.0.0)? Any suggestions will be appreciated. Thanks

[[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] Y label doesn't show up on printing files

2013-07-22 Thread David Winsemius

On Jul 22, 2013, at 3:17 AM, Mohit Dhingra wrote:

 Hello,
 
 I'm using R version 2.15.1 (2012-06-22) -- Roasted Marshmallows .
 
 System info: Linux ubuntu 3.5.0-36-generic #57~precise1-Ubuntu SMP Thu
 Jun 20 18:21:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux.
 
 When I plot something, y label does show up on the pop up image.
 plot (x, rtimel[,2] , xlab=Memory Allocated (in MB), ylab=Response
 Time (in ms), type=l, col=black, ylim=c(0,m) )
 
 But when I try to save it using
 dev.copy(pdf,'response_time_with_memory_direct.pdf')
 dev.off()
 
 Y-label doesn't get printed on the pdf file. Can someone please help?

Perhaps a difficulty with the fonts in your R installation being different than 
the fonts in your pdf viewer?

-- 

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.


Re: [R] problem loading large xlsx file into r

2013-07-22 Thread David Winsemius

On Jul 22, 2013, at 3:09 AM, S N V Krishna wrote:

 Thanks Jim, I tried XLConnect but faced with same error.
 
 options(java.parameters = '-Xmx5g')
 
 library(XLConnect)
 Loading required package: rJava
 XLConnect 0.2-5 by Mirai Solutions GmbH
 http://www.mirai-solutions.com ,
 http://miraisolutions.wordpress.com
 
 cftc = 
 readWorksheetFromFile(d:\\Krishna\\Research\\CFTC_COT\\cftcdata.xlsx, 
 sheet = 'Sheet1')
 Error: OutOfMemoryError (Java): Java heap space

This is an error that is coming from you Java installation, not from R. You may 
need to investigate modifying your Java environment variables. This might not 
be the correct mailing list from which to expect advice on Java setup although 
I seem to rememer seeing advice of this sort offered in the past. Have you done 
a search of the Rhelp archives?

-- 
David.

 
 What is the maximum file size to load into R? is there a better way to load 
 large excel files to R?
 
 Many thanks for the help.
 
 Regards, 
 
 Krishna
 
 -Original Message-
 From: Jim Holtman [mailto:jholt...@gmail.com] 
 Sent: Monday, July 22, 2013 5:10 PM
 To: S N V Krishna
 Cc: r-help@r-project.org
 Subject: Re: [R] problem loading large xlsx file into r
 
 try the XLConnect package and if possible change the xlsx to xls format 
 for better performance.
 
 Sent from my iPad
 
 On Jul 22, 2013, at 1:24, S N V Krishna kris...@primps.com.sg wrote:
 
 Hi,
 
 I am facing trouble when trying to read large xlsx file into R. please find 
 the code and error below. The file I was trying to read has 36,500 rows X 
 188 col, ~ 37 MB size.
 
 options( java.parameters = -Xmx4g )
 
 library(xlsx)
 Loading required package: xlsxjars
 Loading required package: rJava
 
 cftc = read.xlsx(d:\\Krishna\\Research\\CFTC_COT\\cftcdata.xlsx, 1)
 Error in .jcall(RJavaTools, Ljava/lang/Object;, invokeMethod, cl,  :
 
 
 sessionInfo()
 R version 3.0.1 (2013-05-16)
 Platform: x86_64-w64-mingw32/x64 (64-bit)
 
 locale:
 [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United 
 States.1252 [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C 
 [5] LC_TIME=English_United States.1252
 
 attached base packages:
 [1] stats graphics  grDevices utils datasets  methods   base
 
 other attached packages:
 [1] xlsx_0.5.1 xlsxjars_0.5.0 rJava_0.9-5
 
 Many thanks for the help and guidance.
 
 Regards,
 
 Krishna
 
   [[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.

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.


Re: [R] about mix type clust algorithm

2013-07-22 Thread David Winsemius

On Jul 22, 2013, at 4:12 AM, Jose Iparraguirre wrote:

 Dear Cheng,
 
 This question exceeds the topics of this group. However, you may benefit from 
 this recent (and excellent) paper along with the discussions:
 
 Henning, C. and T. Liao (2013). How to find an appropriate clustering for 
 mixed-type variables with application to socio-economy stratification, 
 Journal of Applied Statistics, Vol. 62, Part 3, pp. 309-369.
 

Might be easier to find with the correct author citation:

C. Hennig and T. F. Liao

The first author makes a copy available at his website;
http://www.homepages.ucl.ac.uk/~ucakche/pp.html

-- 
David.
 Regards,
 
 José
 
 Prof. José Iparraguirre
 Chief Economist
 Age UK
 
 Profesor de Economía
 Universidad de Morón
 Morón, Buenos Aires, Argentina
 
 
 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
 Behalf Of Cheng, Yi
 Sent: 22 July 2013 07:23
 To: r-help@r-project.org
 Subject: [R] about mix type clust algorithm
 
 Hi:
 I have tried to find the appropriate clust algorithm for mixed type of data.
 The suggested way I see is:
 
 1.   use daisy to get the dissimilarity matrix
 
 2.   use PAM/hclust by providing the dissimilarity matrix, to get the 
 clusters
 but by following this, when the data set grows bigger say 10,000 rows of 
 data, the dissimilarity matrix will be O(n^2), and out of memory will occur.
 I am wondering is there any better ways to do the mixed type cluster?
 
 Cheng Yi
 
 
   [[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.
 
 The Wireless from Age UK | Radio for grown-ups.
 
 www.ageuk.org.uk/thewireless
 
 
 If you’re looking for a radio station that offers real variety, tune in to 
 The Wireless from Age UK. 
 Whether you choose to listen through the website at 
 www.ageuk.org.uk/thewireless, on digital radio (currently available in London 
 and Yorkshire) or through our TuneIn Radio app, you can look forward to an 
 inspiring mix of music, conversation and useful information 24 hours a day.
 
 
 
 
 ---
 Age UK is a registered charity and company limited by guarantee, (registered 
 charity number 1128267, registered company number 6825798). 
 Registered office: Tavis House, 1-6 Tavistock Square, London WC1H 9NA.
 
 For the purposes of promoting Age UK Insurance, Age UK is an Appointed 
 Representative of Age UK Enterprises Limited, Age UK is an Introducer 
 Appointed Representative of JLT Benefit Solutions Limited and Simplyhealth 
 Access for the purposes of introducing potential annuity and health 
 cash plans customers respectively.  Age UK Enterprises Limited, JLT Benefit 
 Solutions Limited and Simplyhealth Access are all authorised and 
 regulated by the Financial Services Authority. 
 --
 
 This email and any files transmitted with it are confidential and intended 
 solely for the use of the individual or entity to whom they are 
 addressed. If you receive a message in error, please advise the sender and 
 delete immediately.
 
 Except where this email is sent in the usual course of our business, any 
 opinions expressed in this email are those of the author and do not 
 necessarily reflect the opinions of Age UK or its subsidiaries and associated 
 companies. Age UK monitors all e-mail transmissions passing 
 through its network and may block or modify mails which are deemed to be 
 unsuitable.
 
 Age Concern England (charity number 261794) and Help the Aged (charity number 
 272786) and their trading and other associated companies merged 
 on 1st April 2009.  Together they have formed the Age UK Group, dedicated to 
 improving the lives of people in later life.  The three national 
 Age Concerns in Scotland, Northern Ireland and Wales have also merged with 
 Help the Aged in these nations to form three registered charities: 
 Age Scotland, Age NI, Age Cymru.
 
 
 
 
 __
 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
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] fail to install shiny package in R 3.0.1 on Ubuntu

2013-07-22 Thread Orvalho Augusto
Dear Yu

Some of the packages required by shiny were installed for version 2
according to the output provided. So you must at least run this as
superuser on R session:
update.packages()

And answer accordiling.

Then you may try to install shiny.
Caveman
On Jul 22, 2013 8:03 PM, yu ge geyu...@gmail.com wrote:

 Hello there,


 I have been used shiny package on Windows without any problem. Recently I
 switched to Linux OS(Ubuntu 12.04), and installed the latest R version
 3.0.1. But I couldn't install shiny for some reasons. Here are the error
 message:

 ** preparing package for lazy loading
 Error : package ‘codetools’ was built before R 3.0.0: please re-install it
 Error : unable to load R code in package ‘Rcpp’
 ERROR: lazy loading failed for package ‘Rcpp’
 * removing ‘/home/alex/R/x86_64-pc-linux-gnu-library/3.0/Rcpp’
 ERROR: dependency ‘Rcpp’ is not available for package ‘httpuv’
 * removing ‘/home/alex/R/x86_64-pc-linux-gnu-library/3.0/httpuv’
 ERROR: dependency ‘httpuv’ is not available for package ‘shiny’
 * removing ‘/home/alex/R/x86_64-pc-linux-gnu-library/3.0/shiny’

 The downloaded source packages are in
 ‘/tmp/RtmpA7KumO/downloaded_packages’
 Warning messages:
 1: In install.packages(shiny) :
   installation of package ‘Rcpp’ had non-zero exit status
 2: In install.packages(shiny) :
   installation of package ‘httpuv’ had non-zero exit status
 3: In install.packages(shiny) :
   installation of package ‘shiny’ had non-zero exit status


 I am newbee for Linux OS. Do I need to install an early R version(older
 than 3.0.0)? Any suggestions will be appreciated. Thanks

 [[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.


[R] create data frame with coefficients from many regressions

2013-07-22 Thread iza.ch1

 Hi !
 
 I want to ask if somebody knows the way to create data frame with 
 coefficients from many regressions 
 I regress the first column from ret against the first columns from median, 
 then the second with the second and so on.
 This is the code used for regression
 
 i-1:6
 lapply(seq_len(ncol(ret)),function(i) {lm(ret[,i]~median[,i])}
 
 I get 6 results for each regression 
 
 [[1]]
 
 Call:
 lm(formula = ret[, i] ~ median[, i])
 
 Coefficients:
 (Intercept)  median[, i]  
   01  
 
 
 [[2]]
 
 Call:
 lm(formula = ret[, i] ~ median[, i])
 
 Coefficients:
 (Intercept)  median[, i]  
 -1.411e-171.000e+00 
 
 now I would like to create a data frame with intercepts which looks like it
 
 [[1]]  [[2]]
 Intercept
 median
 
 I tried to use ddply command but it does not work. I will be very grateful 
 for the hint :)
 
 Thank you in advance
 
 
__
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] create data frame with coefficients from many regressions

2013-07-22 Thread arun
set.seed(28)
dat1- as.data.frame(matrix(sample(1:20,100,replace=TRUE),ncol=10))

set.seed(49)
dat2- as.data.frame(matrix(sample(40:80,100,replace=TRUE),ncol=10))

 sapply(seq_len(ncol(dat1)),function(i) {x1- 
summary(lm(dat2[,i]~dat1[,i]));x1$coef[,1]})
#  [,1]   [,2]   [,3]   [,4]   [,5]  [,6]
#(Intercept) 50.3768788 53.5300207 65.2972973 55.6530015 58.5158172 79.368165
#dat1[, i]    0.4770829  0.2767426 -0.4554849  0.3089312  0.7785589 -1.193601
#  [,7]  [,8]  [,9]   [,10]
#(Intercept) 59.8130393 67.089662 74.593072 66.39938809
#dat1[, i]   -0.4659636 -1.498945 -1.221709  0.05624853
 
as.data.frame(sapply(seq_len(ncol(dat1)),function(i) {x1- 
summary(lm(dat2[,i]~dat1[,i]));x1$coef[,1]}))


A.K.




- Original Message -
From: iza.ch1 iza@op.pl
To: r-help@r-project.org
Cc: 
Sent: Monday, July 22, 2013 3:11 PM
Subject: [R] create data frame with coefficients from many regressions


 Hi !
 
 I want to ask if somebody knows the way to create data frame with 
 coefficients from many regressions 
 I regress the first column from ret against the first columns from median, 
 then the second with the second and so on.
 This is the code used for regression
 
 i-1:6
 lapply(seq_len(ncol(ret)),function(i) {lm(ret[,i]~median[,i])}
 
 I get 6 results for each regression 
 
 [[1]]
 
 Call:
 lm(formula = ret[, i] ~ median[, i])
 
 Coefficients:
 (Intercept)  median[, i]  
           0            1  
 
 
 [[2]]
 
 Call:
 lm(formula = ret[, i] ~ median[, i])
 
 Coefficients:
 (Intercept)  median[, i]  
 -1.411e-17    1.000e+00 
 
 now I would like to create a data frame with intercepts which looks like it
 
                         [[1]]          [[2]]
 Intercept
 median
 
 I tried to use ddply command but it does not work. I will be very grateful 
 for the hint :)
 
 Thank you in advance
 
 
__
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] create data frame with coefficients from many regressions

2013-07-22 Thread Rui Barradas

Hello,

Using Arun's data example, you can also do the following.



set.seed(28)
dat1- as.data.frame(matrix(sample(1:20,100,replace=TRUE),ncol=10))

set.seed(49)
dat2- as.data.frame(matrix(sample(40:80,100,replace=TRUE),ncol=10))

lm.list - lapply(seq_len(ncol(dat1)), function(i) lm(dat1[,i] ~ dat2[,i]))

do.call(cbind, lapply(lm.list, coef))   # object of class matrix


Hope this helps,

Rui Barradas


Em 22-07-2013 20:11, iza.ch1 escreveu:



Hi !

I want to ask if somebody knows the way to create data frame with coefficients 
from many regressions
I regress the first column from ret against the first columns from median, then 
the second with the second and so on.
This is the code used for regression

i-1:6
lapply(seq_len(ncol(ret)),function(i) {lm(ret[,i]~median[,i])}

I get 6 results for each regression

[[1]]

Call:
lm(formula = ret[, i] ~ median[, i])

Coefficients:
(Intercept)  median[, i]
   01


[[2]]

Call:
lm(formula = ret[, i] ~ median[, i])

Coefficients:
(Intercept)  median[, i]
-1.411e-171.000e+00

now I would like to create a data frame with intercepts which looks like it

 [[1]]  [[2]]
Intercept
median

I tried to use ddply command but it does not work. I will be very grateful for 
the hint :)

Thank you in advance



__
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] Selecting names with regard to visit frequency

2013-07-22 Thread arun
Hi,
myvector- c(3,2,7,4,1)
names(myvector)-paste0(name,1:5)
names(myvector)[myvector=3  myvector=5] 
#[1] name1 name4
#or
names(myvector)[myvector%in% 3:5]
#[1] name1 name4

#or

 names(myvector)[!is.na(match(myvector,3:5))]
#[1] name1 name4



A.K.


Hello all, 
I am new to R but trying to learn. 

I have a vector of names with visit frequencies (myvector) in the form 

name1 name2 name3 name4 name5 
3              2            7            4            1 

I can select names of patients that have visited more often: 

frequent.pats-names(myvector) [myvector5] 

or those that have visited less often, but how could I get the names of those 
who visited, say between 35 times? 
Thanks 
steele

__
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] weighted average

2013-07-22 Thread Robert Lynch
I am trying to compute GPA from class grades(which have been normallized)
I have for example the following matrix

Master =
SIDB2AB2BB2C   C2A C2BC2CC118AC118B C118C
0010.010.5  -0.41.2   -1.8 0.3  -0.3   0.4
  0.5
0020.010.5  -0.40.5   -0.4 1.2  -1.8   0.3
  -0.3
0030.040.05 0.5-0.4 - 0.5 0.4  -1.2   1.8
0.3
etc

Where each column has a zero mean and a standard deviation of 1.  I want to
calculate a weighted average for each row(student ID) that takes into
account that
B2A, C118A, C118B, and C118C are all 4 unit classes, and the rest, B2B,
B2C, C2A,C2B,C2C are 5 unit classes

I have tried
Units-c(4,5,5,5,5,5,4,4,4)
Master$zGPA -weighted.means(Master[,2:10],Units)

But that gets me one number and not a vector.

[[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] weighted average

2013-07-22 Thread David Winsemius

On Jul 22, 2013, at 3:12 PM, Robert Lynch wrote:

 I am trying to compute GPA from class grades(which have been normallized)
 I have for example the following matrix
 
 Master =
 SIDB2AB2BB2C   C2A C2BC2CC118AC118B C118C
 0010.010.5  -0.41.2   -1.8 0.3  -0.3   0.4
  0.5
 0020.010.5  -0.40.5   -0.4 1.2  -1.8   0.3
  -0.3
 0030.040.05 0.5-0.4 - 0.5 0.4  -1.2   1.8
0.3
 etc
 
 Where each column has a zero mean and a standard deviation of 1.  I want to
 calculate a weighted average for each row(student ID) that takes into
 account that
 B2A, C118A, C118B, and C118C are all 4 unit classes, and the rest, B2B,
 B2C, C2A,C2B,C2C are 5 unit classes
 
 I have tried
 Units-c(4,5,5,5,5,5,4,4,4)
 Master$zGPA -weighted.means(Master[,2:10],Units)
 
 But that gets me one number and not a vector.

Perhaps something along lines of 

 Master$zGPA -sapply( weighted.means(Master[,2:10], weighted.means, 
weghts=Units)

(Untested in absence of data or name of package from which function is loaded.)

 ?weighted.means
No documentation for ‘weighted.means’ in specified packages and libraries:
you could try ‘??weighted.means’

--- 
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.


Re: [R] weighted average

2013-07-22 Thread arun
Hi,
May be this helps:
Master-read.table(text=
SID    B2A    B2B    B2C  C2A    C2B    C2C    C118A    C118B C118C
001    0.01    0.5  -0.4    1.2  -1.8    0.3  -0.3  0.4   0.5
002    0.01    0.5  -0.4    0.5  -0.4    1.2  -1.8  0.3  -0.3
003    0.04    0.05    0.5    -0.4    -0.5    0.4  -1.2  1.8 0.3
,sep=,header=TRUE)
 library(matrixStats)


  Master$zGPA-rowWeightedMeans(as.matrix(Master[,-1]),Units)
 Master
#  SID  B2A  B2B  B2C  C2A  C2B C2C C118A C118B C118C zGPA
#1   1 0.01 0.50 -0.4  1.2 -1.8 0.3  -0.3   0.4   0.5  0.035121951
#2   2 0.01 0.50 -0.4  0.5 -0.4 1.2  -1.8   0.3  -0.3 -0.003902439
#3   3 0.04 0.05  0.5 -0.4 -0.5 0.4  -1.2   1.8   0.3  0.097804878
A.K.

- Original Message -
From: Robert Lynch robert.b.ly...@gmail.com
To: r-help@r-project.org
Cc: 
Sent: Monday, July 22, 2013 6:12 PM
Subject: [R] weighted average

I am trying to compute GPA from class grades(which have been normallized)
I have for example the following matrix

Master =
SID    B2A    B2B    B2C   C2A     C2B    C2C    C118A    C118B     C118C
001    0.01    0.5      -0.4    1.2       -1.8     0.3      -0.3       0.4
          0.5
002    0.01    0.5      -0.4    0.5       -0.4     1.2      -1.8       0.3
          -0.3
003    0.04    0.05     0.5    -0.4     - 0.5     0.4      -1.2       1.8
        0.3
etc

Where each column has a zero mean and a standard deviation of 1.  I want to
calculate a weighted average for each row(student ID) that takes into
account that
B2A, C118A, C118B, and C118C are all 4 unit classes, and the rest, B2B,
B2C, C2A,C2B,C2C are 5 unit classes

I have tried
Units-c(4,5,5,5,5,5,4,4,4)
Master$zGPA -weighted.means(Master[,2:10],Units)

But that gets me one number and not a vector.

    [[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] weighted average

2013-07-22 Thread arun


In that case:
Master1- Master

Master1$zGPA-sapply(seq_len(nrow(Master1[,-1])),function(i) 
weighted.mean(Master1[i,-1],Units))

Master1$zGPA
#[1]  0.035121951 -0.003902439  0.097804878
all.equal(Master,Master1)
#[1] TRUE

A.K.



From: Robert Lynch robert.b.ly...@gmail.com
To: arun smartpink...@yahoo.com 
Sent: Monday, July 22, 2013 6:35 PM
Subject: Re: [R] weighted average



weighted.mean is the function.  My apologies for appending an s





On Mon, Jul 22, 2013 at 3:31 PM, arun smartpink...@yahoo.com wrote:

Hi,

I couldn't find the function `weighted.means` using ?weighted.means or 
??weighted.means.  It would be useful to provide the library information.




- Original Message -
From: arun smartpink...@yahoo.com
To: Robert Lynch robert.b.ly...@gmail.com
Cc: R help r-help@r-project.org
Sent: Monday, July 22, 2013 6:26 PM
Subject: Re: [R] weighted average

Hi,
May be this helps:
Master-read.table(text=
SID    B2A    B2B    B2C  C2A    C2B    C2C    C118A    C118B C118C
001    0.01    0.5  -0.4    1.2  -1.8    0.3  -0.3  0.4   0.5
002    0.01    0.5  -0.4    0.5  -0.4    1.2  -1.8  0.3  -0.3
003    0.04    0.05    0.5    -0.4    -0.5    0.4  -1.2  1.8 0.3
,sep=,header=TRUE)
 library(matrixStats)


  Master$zGPA-rowWeightedMeans(as.matrix(Master[,-1]),Units)
 Master
#  SID  B2A  B2B  B2C  C2A  C2B C2C C118A C118B C118C zGPA
#1   1 0.01 0.50 -0.4  1.2 -1.8 0.3  -0.3   0.4   0.5  0.035121951
#2   2 0.01 0.50 -0.4  0.5 -0.4 1.2  -1.8   0.3  -0.3 -0.003902439
#3   3 0.04 0.05  0.5 -0.4 -0.5 0.4  -1.2   1.8   0.3  0.097804878
A.K.

- Original Message -
From: Robert Lynch robert.b.ly...@gmail.com
To: r-help@r-project.org
Cc:
Sent: Monday, July 22, 2013 6:12 PM
Subject: [R] weighted average

I am trying to compute GPA from class grades(which have been normallized)
I have for example the following matrix

Master =
SID    B2A    B2B    B2C   C2A     C2B    C2C    C118A    C118B     C118C
001    0.01    0.5      -0.4    1.2       -1.8     0.3      -0.3       0.4
          0.5
002    0.01    0.5      -0.4    0.5       -0.4     1.2      -1.8       0.3
          -0.3
003    0.04    0.05     0.5    -0.4     - 0.5     0.4      -1.2       1.8
        0.3
etc

Where each column has a zero mean and a standard deviation of 1.  I want to
calculate a weighted average for each row(student ID) that takes into
account that
B2A, C118A, C118B, and C118C are all 4 unit classes, and the rest, B2B,
B2C, C2A,C2B,C2C are 5 unit classes

I have tried
Units-c(4,5,5,5,5,5,4,4,4)
Master$zGPA -weighted.means(Master[,2:10],Units)

But that gets me one number and not a vector.

    [[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] weighted average

2013-07-22 Thread David Winsemius

On Jul 22, 2013, at 3:23 PM, David Winsemius wrote:

 
 On Jul 22, 2013, at 3:12 PM, Robert Lynch wrote:
 
 I am trying to compute GPA from class grades(which have been normallized)
 I have for example the following matrix
 
 Master =
 SIDB2AB2BB2C   C2A C2BC2CC118AC118B C118C
 0010.010.5  -0.41.2   -1.8 0.3  -0.3   0.4
 0.5
 0020.010.5  -0.40.5   -0.4 1.2  -1.8   0.3
 -0.3
 0030.040.05 0.5-0.4 - 0.5 0.4  -1.2   1.8
   0.3
 etc
 
 Where each column has a zero mean and a standard deviation of 1.  I want to
 calculate a weighted average for each row(student ID) that takes into
 account that
 B2A, C118A, C118B, and C118C are all 4 unit classes, and the rest, B2B,
 B2C, C2A,C2B,C2C are 5 unit classes
 
 I have tried
 Units-c(4,5,5,5,5,5,4,4,4)
 Master$zGPA -weighted.means(Master[,2:10],Units)
 
 But that gets me one number and not a vector.
 
 Perhaps something along lines of 
 
 Master$zGPA -sapply( weighted.means(Master[,2:10], weighted.means, 
 weghts=Units)
 
 (Untested in absence of data or name of package from which function is 
 loaded.)
 
 ?weighted.means
 No documentation for ‘weighted.means’ in specified packages and libraries:
 you could try ‘??weighted.means’

If you are using weighted.mean and want this applied by row (one row per 
student I guess) , then probably this would be better:

Master$zGPA -  apply( Master[,2:10],  1, weighted.means, w=Units)

-- 
David.

 
 --- 
 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.

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.


Re: [R] Different x-axis scales using c() in latticeExtra

2013-07-22 Thread Jeff Stevens
Well, I finally found a work around.  It's not pretty, but it works.
I had to alter a number of padding values for par.settings in xyplot()
and minutely control the position and panel.width in plot.trellis().

Thanks for the help.

response - c(76, 14, 15, 44, 26, 19, 74, 123, 49, 8, 56, 17, 18)
predictor1 - c(107, 7, 25, 501, 64, 88, 344, 367, 379, 10, 66, 31, 32)
predictor2 - c(10, 9, 8, 10, 29, 27, 55, 48, 2, 6, 14, 10, 5)
predictor3 - c(67, 22, 66, 41, 72, 64, 69, 63, 64, 70, 60, 75, 78)

pred1_plot - xyplot(response ~ predictor1, scales = list(log = TRUE,
equispaced.log = FALSE, y = list(tck = c(1,0))),
  par.settings = list(layout.widths = list(ylab.axis.padding = 1, ylab
= 1, axis.left = 0.8, panel = 1, between = 1, axis.right = 0,
ylab.right = 0, right.padding = 0), axis.components = list(left =
list(pad2 = 0))),
  panel = function(x, y, ...) {
panel.xyplot(x, y, type = c(p, r), cex = 2)
panel.text(x = log10(8), y = log10(120), labels = (a))
  }
)

pred2_plot - xyplot(response ~ predictor2, ylab = NULL, scales =
list(log = TRUE, equispaced.log = FALSE, y = list(labels = , tck =
0)),
  par.settings = list(layout.widths = list(ylab.axis.padding = 0, ylab
= 0, axis.left = 0, panel = 1, between = 1, axis.right = 0, ylab.right
= 0, right.padding = 0), axis.components = list(left = list(pad2 =
0))),
  panel = function(x, y, ...) {
panel.xyplot(x, y, type = c(p, r), cex = 2)
panel.text(x = log10(2), y = log10(120), labels = (b))
  }
)

pred3_plot - xyplot(response ~ predictor3, ylab = NULL, scales =
list(y = list(log = TRUE, equispaced.log = FALSE, labels = , tck =
c(0, 1))),
  par.settings = list(layout.widths = list(ylab.axis.padding = 0, ylab
= 0, axis.left = 0, panel = 1, between = 1, axis.right = 0, ylab.right
= 0, right.padding = 0), axis.components = list(left = list(pad2 =
0))),
  panel = function(x, y, ...) {
panel.xyplot(x, y, type = c(p, r), cex = 2)
panel.text(x = 22, y = log10(120), labels = (c))
  }
)

pdf(file = test_plot.pdf, width = 12, height = 5)
print(pred1_plot, split = c(1,1,3,1), position = c(0.02, 0, 1, 1),
panel.width = list(x = 3.6, unit = in), more=T)
print(pred2_plot, split = c(2,1,3,1), position = c(0.045, 0, 1, 1),
panel.width = list(x = 3.5, unit = in), more=T)
print(pred3_plot, split = c(3,1,3,1), panel.width = list(x = 3.5, unit
= in), more=F)
dev.off()




On Sat, Jul 20, 2013 at 6:45 PM, Felix Andrews fe...@nfrac.org wrote:
 latticeExtra's c() can not combine logarithmic with linear x scales,
 I'm afraid.  I would recommend displaying each separate plot on one
 page using plot.trellis() or the gridExtra function that John Kane
 mentioned.

 Cheers
 Felix


 On 21 July 2013 02:50, David Winsemius dwinsem...@comcast.net wrote:

 On Jul 19, 2013, at 8:18 PM, Jeff Stevens wrote:

 Hi,

 I would like to combine multiple xyplots into a single, multipanel
 display.  Using R 3.0.1 in Ubuntu, I have used c() from latticeExtra
 to combine three plots, but the x-axis for two plots are on a log
 scale and the other is on a normal scale.  I also have included
 equispace.log=FALSE to clean up the tick labels.  However, when I try
 all of these, the x-axis scale of the first panel is used for all
 three.  How do I keep different scales for the different panels?

 Here is an example:
 library(lattice)
 library(latticeExtra)
 response - c(76, 14, 15, 44, 26, 19, 74, 123, 49, 8, 56, 17, 18)
 predictor1 - c(107, 7, 25, 501, 64, 88, 344, 367, 379, 10, 66, 31, 32)
 predictor2 - c(10, 9, 8, 10, 29, 27, 55, 48, 2, 6, 14, 10, 5)
 predictor3 - c(67, 22, 66, 41, 72, 64, 69, 63, 64, 70, 60, 75, 78)

 pred1_plot - xyplot(response ~ predictor1, scales = list(log = TRUE,
 equispaced.log = FALSE),
  panel = function(x, y, ...) {
panel.xyplot(x, y, type = c(p, r), cex = 2)
panel.text(x = log10(8), y = log10(120), labels = (a))
  }
 )

 pred2_plot - xyplot(response ~ predictor2, scales = list(log = TRUE,
 equispaced.log = FALSE),
  panel = function(x, y, ...) {
panel.xyplot(x, y, type = c(p, r), cex = 2)
panel.text(x = log10(2), y = log10(120), labels = (b))
  }
 )

 pred3_plot - xyplot(response ~ predictor3, scales = list(y = list(log
 = TRUE, equispaced.log = FALSE)),
  panel = function(x, y, ...) {
panel.xyplot(x, y, type = c(p, r), cex = 2)
panel.text(x = 22, y = log10(120), labels = (c))
  }
 )

 all_plots - c(pred1_plot, pred2_plot, pred3_plot, layout = c(3, 1), x.same 
 = F)
 update(all_plots, xlab=c(Predictor 1,Predictor 2, Predictor 3),
 scales = list(y=list(log=T, equispaced.log=FALSE), x = c(list(log=T,
 equispaced.log=FALSE), list(log=T, equispaced.log=FALSE),
 list(log=F

 update(all_plots, xlab=c(Predictor 1,Predictor 2, Predictor 3),
 scales = c(list(log = TRUE, equispaced.log = FALSE), list(log = TRUE,
 equispaced.log = FALSE), list(y=list(log=T, equispaced.log = FALSE

 Any help is appreciated!

 I assume there was a notice o your console that there were warnings, right? 
 You should offer the full texts of warnings and error 

[R] Error with sem function df = -6

2013-07-22 Thread Immanuel Williams
Hello all,
I have an issue where I am generating data and trying to confirm the
estimates using a sem.  I keep getting an error about the degree of freedom
being negative Error in sem.default(ram, S = S, N = N, raw = raw, data =
data, pattern.number = pattern.number,  : The model has negative degrees of
freedom = -6

Can someone explain this error or tell me what is wrong with my model?
Thank you.
Here is the code:




model.ram1 - specifyModel()
UNIT - Y1, ty,0.3
UNIT - Z1, tz1,-0.1
UNIT - Z2, tz2,0.1
CF - Y1, lamy,0.5
CF - Z1, lamz1,0.85
CF - Z2, lamz2,0.2
UNIT - CF, k
Y1 - Y1, psi3, NA
Z1 - Z1, psi1, NA
Z2 - Z2, psi2, NA
CF - CF,vCF1,NA

sem.m1-sem(model=model.ram1,S=S2,N=500,fixed.x=UNIT,raw=T)

-- 

I.J. Williams

Ph.D. Student in Education Measurement and Statistics
Statistics MS

Mathematics BS

Rutgers University

[[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] constructing a daily time series

2013-07-22 Thread shanxiao
Dear all, 

 

I have a vector of observations through day, and based on it, I try to
construct a daily time series with the R function ts(), but it seems that it
only enables to construct a weekly, monthly, quarterly and yearly time
series, does anyone know whether there is an option to build a daily time
series? Thanks. 

 

Shan Xiao

Ph.D. student of Biostatistics, 

Department of Biostatistics, IUPUI.

 


[[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] constructing a daily time series

2013-07-22 Thread Pascal Oettli
Hello,

?zoo

Regards,
Pascal


2013/7/23 shanxiao shanx...@umail.iu.edu

 Dear all,



 I have a vector of observations through day, and based on it, I try to
 construct a daily time series with the R function ts(), but it seems that
 it
 only enables to construct a weekly, monthly, quarterly and yearly time
 series, does anyone know whether there is an option to build a daily time
 series? Thanks.



 Shan Xiao

 Ph.D. student of Biostatistics,

 Department of Biostatistics, IUPUI.




 [[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.