Re: [R] Please help me, I'm trying to update my version of R

2016-08-22 Thread Thomas Mailund
Hi Ken,

You are trying to install R as a package. That won't work. The .pkg file you 
downloaded from https://cran.r-project.org/bin/macosx/ is an installer, though, 
so if you just double-click on it, it should take you through the installation. 
After that you probably need to install a number of packages, since the ones 
you have installed for version 3.2 R won't be available in the 3.3 
installation, but *those* packages you can install using install.packages.

Cheers

--
Thomas Mailund

On 22 August 2016 at 22:17:50, KMNanus 
(kmna...@gmail.com) wrote:

I’m a newbie running 3.2.4 on a mac equipped with Yosemite (10.10.5).

I want to update to 3.3.1 and have downloaded the package, but have not been 
able to install it. I’ve tried install.packages("R-3.3.1.tar.gz”) and 
install.packages("R-3.3.1.pkg”) after downloading both files.

I get an error msg - "package ‘R-3.3.1.pkg’ is not available (for R version 
3.2.4)"

I know this question has shown up on several message boards but I’m having 
trouble understanding the process.

Is there a straightforward way to update my version of R and, if successful, 
will R automatically work with the packages I’ve installed?

Ken Nanus
kmna...@gmail.com
914-450-0816 (tel)
347-730-4813 (fax)



__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R] Please help me, I'm trying to update my version of R

2016-08-22 Thread KMNanus
I’m a newbie running 3.2.4 on a mac equipped with Yosemite (10.10.5).

I want to update to 3.3.1 and have downloaded the package, but have not been 
able to install it.  I’ve tried install.packages("R-3.3.1.tar.gz”) and 
install.packages("R-3.3.1.pkg”) after downloading both files.

I get an error msg - "package ‘R-3.3.1.pkg’ is not available (for R version 
3.2.4)"

I know this question has shown up on several message boards but I’m having 
trouble understanding the process.

Is there a straightforward way to update my version of R and, if successful, 
will R automatically work with the packages I’ve installed?

Ken Nanus
kmna...@gmail.com
914-450-0816 (tel)
347-730-4813 (fax)



__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Estimated Effects Not Balanced

2016-08-22 Thread Bert Gunter
Thanks, Rich. I didn't notice that!

-- Bert
Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Mon, Aug 22, 2016 at 1:43 PM, Richard M. Heiberger  wrote:
> The problem is that you have 12 observations and 1+2+10=13 degrees of freedom.
> There should be 1 + 2 + 8 = 11 degrees of freedom.
> Probably one of your variables is masked by something else in you workspace.
> Protect yourself by using a data.frame
>
>> tmp <- data.frame(A=factor(c(1,1,1,1,1,1,2,2,2,2,2,2)),
> + B=factor(c(1,1,2,2,3,3,1,1,2,2,3,3)),
> + y=rnorm(12))
>> mod <- aov(y ~ A+B, data=tmp)
>> summary(mod)
> Df Sum Sq Mean Sq F value Pr(>F)
> A1  1.553   1.553   1.334  0.281
> B2  3.158   1.579   1.357  0.311
> Residuals8  9.311   1.164
>
> On Mon, Aug 22, 2016 at 11:15 AM, Justin Thong  
> wrote:
>> Something does not make sense in R. It has to do with the question of
>> balance and unbalance.
>>
>> *A<-factor(c(1,1,1,1,1,1,2,2,2,2,2,2))*
>> *B<-factor(c(1,1,2,2,3,3,1,1,2,2,3,3))*
>> *y<-rnorm(12)*
>> *mod<-aov(y~A+B)*
>>
>> I was under the impression that the design is balanced ie order does not
>> effect the sums of squares. However, when I compute the anova R reports
>> that the Estimated Effects are Unbalanced. I thought that when all
>> combinations of levels of A and B have equal replications then the design
>> is called balanced. But, R tends to think that when not all levels of A and
>> levels of B have equal replication, then the "Estimated Effects are
>> unbalanced" Is this the same as the design being unbalanced? Because
>> for the example below, where the error occured, the order does not matter
>> (which make me think that the design is balanced).
>>
>>
>> *Call:*
>> *   aov(formula = y ~ A + B)*
>>
>> *Terms:*
>> *A B Residuals*
>> *Sum of Squares   0.872572  0.025604 16.805706*
>> *Deg. of Freedom 1 210*
>>
>> *Residual standard error: 1.296368*
>> *Estimated effects may be unbalanced*
>> --
>> Yours sincerely,
>> Justin
>>
>> *I check my email at 9AM and 4PM everyday*
>> *If you have an EMERGENCY, contact me at +447938674419(UK) or
>> +60125056192(Malaysia)*
>>
>> [[alternative HTML version deleted]]
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Estimated Effects Not Balanced

2016-08-22 Thread Richard M. Heiberger
The problem is that you have 12 observations and 1+2+10=13 degrees of freedom.
There should be 1 + 2 + 8 = 11 degrees of freedom.
Probably one of your variables is masked by something else in you workspace.
Protect yourself by using a data.frame

> tmp <- data.frame(A=factor(c(1,1,1,1,1,1,2,2,2,2,2,2)),
+ B=factor(c(1,1,2,2,3,3,1,1,2,2,3,3)),
+ y=rnorm(12))
> mod <- aov(y ~ A+B, data=tmp)
> summary(mod)
Df Sum Sq Mean Sq F value Pr(>F)
A1  1.553   1.553   1.334  0.281
B2  3.158   1.579   1.357  0.311
Residuals8  9.311   1.164

On Mon, Aug 22, 2016 at 11:15 AM, Justin Thong  wrote:
> Something does not make sense in R. It has to do with the question of
> balance and unbalance.
>
> *A<-factor(c(1,1,1,1,1,1,2,2,2,2,2,2))*
> *B<-factor(c(1,1,2,2,3,3,1,1,2,2,3,3))*
> *y<-rnorm(12)*
> *mod<-aov(y~A+B)*
>
> I was under the impression that the design is balanced ie order does not
> effect the sums of squares. However, when I compute the anova R reports
> that the Estimated Effects are Unbalanced. I thought that when all
> combinations of levels of A and B have equal replications then the design
> is called balanced. But, R tends to think that when not all levels of A and
> levels of B have equal replication, then the "Estimated Effects are
> unbalanced" Is this the same as the design being unbalanced? Because
> for the example below, where the error occured, the order does not matter
> (which make me think that the design is balanced).
>
>
> *Call:*
> *   aov(formula = y ~ A + B)*
>
> *Terms:*
> *A B Residuals*
> *Sum of Squares   0.872572  0.025604 16.805706*
> *Deg. of Freedom 1 210*
>
> *Residual standard error: 1.296368*
> *Estimated effects may be unbalanced*
> --
> Yours sincerely,
> Justin
>
> *I check my email at 9AM and 4PM everyday*
> *If you have an EMERGENCY, contact me at +447938674419(UK) or
> +60125056192(Malaysia)*
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Loop over folder files

2016-08-22 Thread David Winsemius

> On Aug 22, 2016, at 10:40 AM, Juan Ceccarelli Arias  wrote:
> 
> I removed the data,frame=True...
> I obtain this warnings...
> Error in read.dta(fuente[i]) : not a Stata version 5-12 .dta file

Well, that seems fairly self-explanatory. What version of Stata are you using 
and does it have capacity to write to one of hte versions that are supported by 
read.dta?

-- 
David.


> In addition: There were 50 or more warnings (use warnings() to see the
> first 50)
> 
> the warnings() throws this
> Warning messages:
> 1: In `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels) else
> paste0(labels,  ... :
>  duplicated levels in factors are deprecated
> 2: In `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels) else
> paste0(labels,  ... :
>  duplicated levels in factors are deprecated
> 3: In `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels) else
> paste0(labels,  ... :
>  duplicated levels in factors are deprecated
> 4: In `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels) else
> paste0(labels,  ... :
>  duplicated levels in factors are deprecated
> 5: In `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels) else
> paste0(labels,  ... :
>  duplicated levels in factors are deprecated
> 
> 
> 
> On Mon, Aug 22, 2016 at 2:32 PM,  wrote:
> 
>> Hello,
>> 
>> That argument doesn't exist, hence the error.
>> Read the help page ?read.dta more carefully. You will see that already
>> read.dta reads into a data.frame.
>> 
>> Hope this helps,
>> 
>> Rui Barradas
>> 
>> 
>> Citando Juan Ceccarelli Arias :
>> 
>> Hi
>> I need to apply some code over some stata files that are in folder.
>> I've wrote this
>> 
>> library(foreign)
>> 
>> fuente=list.files("C:/Users/Jceccarelli/Bases/Stata", pattern="dta$",
>> full.names=FALSE)
>> 
>> for (i in 1:length(fuente)){
>> 
>> xxx=read.dta(fuente[i], to.data.frame=TRUE)
>> 
>> 
>> }
>> 
>> But i get this error
>> 
>> Error in read.dta(fuente[i], to.data.frame = TRUE) :
>> unused argument (to.data.frame = TRUE)
>> 
>> What am i doing wrong?
>> 
>>[[alternative HTML version deleted]]
>> 
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/
>> posting-guide.htmland provide commented, minimal, self-contained,
>> reproducible code.
>> 
>> 
>> 
>> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Loop over folder files

2016-08-22 Thread Juan Ceccarelli Arias
I removed the data,frame=True...
I obtain this warnings...
Error in read.dta(fuente[i]) : not a Stata version 5-12 .dta file
In addition: There were 50 or more warnings (use warnings() to see the
first 50)

the warnings() throws this
Warning messages:
1: In `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels) else
paste0(labels,  ... :
  duplicated levels in factors are deprecated
2: In `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels) else
paste0(labels,  ... :
  duplicated levels in factors are deprecated
3: In `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels) else
paste0(labels,  ... :
  duplicated levels in factors are deprecated
4: In `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels) else
paste0(labels,  ... :
  duplicated levels in factors are deprecated
5: In `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels) else
paste0(labels,  ... :
  duplicated levels in factors are deprecated



On Mon, Aug 22, 2016 at 2:32 PM,  wrote:

> Hello,
>
> That argument doesn't exist, hence the error.
> Read the help page ?read.dta more carefully. You will see that already
> read.dta reads into a data.frame.
>
> Hope this helps,
>
> Rui Barradas
>
>
> Citando Juan Ceccarelli Arias :
>
> Hi
> I need to apply some code over some stata files that are in folder.
> I've wrote this
>
> library(foreign)
>
> fuente=list.files("C:/Users/Jceccarelli/Bases/Stata", pattern="dta$",
> full.names=FALSE)
>
> for (i in 1:length(fuente)){
>
> xxx=read.dta(fuente[i], to.data.frame=TRUE)
>
>
> }
>
> But i get this error
>
> Error in read.dta(fuente[i], to.data.frame = TRUE) :
> unused argument (to.data.frame = TRUE)
>
> What am i doing wrong?
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.htmland provide commented, minimal, self-contained,
> reproducible code.
>
>
>
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] persp fail with non-equidistant dates

2016-08-22 Thread Duncan Murdoch

Please keep discussion on the mailing list.

On 22/08/2016 12:08 PM, Tomas Bayer wrote:

Hello,
we have tried the pre-processing till now but also with this error message:

akima.li <- interp(x, y, F, xo=seq(min(x), max(x), length = 100),
yo=seq(min(y), max(y), length = 100))
Error: could not find function "interp"

We have tried the same with interp.old and interp.new.
We also got the same error message by packages akima and rgl although they
are installed (confirmed by apt and synaptic, too).
Till now, all interpolation routines have failed.
What would we use as the ideal preparation to persp and contour?


If you are using the interp() function from the akima package,  it 
appears you didn't attach it.  Use


library( pkg )

to attach a package named "pkg".  You may need to install the package 
first; use


install.packages("akima")

if so.

The variable name F may cause you problems: many people use F as an 
abbreviation for FALSE; it's a standard variable defined in the base 
package.  It's a good idea to avoid masking that and causing yourself 
confusion later.


If this advice doesn't fix your problem, then please post a reproducible 
example for others to try.  You might want to select a subset of your 
data if it's too big or too private to post here.


Duncan Murdoch



Thanks,

Tomas Bayer


On 22/08/2016 11:17 AM, Tomas Bayer wrote:

Hello,
when I plotted non-equidistant data in 3D (using persp and contour), it
was ended with the same error message:


persp(y, x, z, xlab="latitude", ylab="longitude", zlab="altiude",

main="Altitude")
Error in persp.default(y, x, z, xlab = "latitude", ylab = "longitude",
:
  increasing 'x' and 'y' values expected

How to fix it? The original data are in columns

 50.8492514.65715 614.0  48909.14   -62.49  99  48929  5  122306
 50.8491914.65702 617.0  48816.32  -145.82  69  48836  6  122331
 50.8490814.65681 622.0  49113.40 6.64  99  49133  4  122442


You haven't shown us what is in y, x and z, but it looks as though you
haven't got data in the form required by persp, i.e. a vector of
increasing values in each of the first two arguments, and a matrix of
values in the third.  Using your variable names, you'd want z[i,j] to
correspond to y[i] and x[j].

If you just have a collection of (y, x, z) triples, you'll need to do
some pre-processing to fit a surface and produce the required inputs.

Duncan Murdoch





Tomáš Bayer
  ,   ,
 / \
((__-^^-,-^^-__))
 `-_---' `---_-'
  `--|o` 'o|--'
 \  `  /
  ): :(
  :o_o:
   "-"
GNU's Not Unix!




__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Loop over folder files

2016-08-22 Thread ruipbarradas
Hello,

That argument doesn't exist, hence the error.
Read the help page ?read.dta more carefully. You will see that already  
read.dta reads into a data.frame.

Hope this helps,

Rui Barradas
 

Citando Juan Ceccarelli Arias :

> Hi
> I need to apply some code over some stata files that are in folder.
> I've wrote this
>
> library(foreign)
>
> fuente=list.files("C:/Users/Jceccarelli/Bases/Stata", pattern="dta$",
> full.names=FALSE)
>
> for (i in 1:length(fuente)){
>
> xxx=read.dta(fuente[i], to.data.frame=TRUE)
>
> }
>
> But i get this error
>
> Error in read.dta(fuente[i], to.data.frame = TRUE) :
> unused argument (to.data.frame = TRUE)
>
> What am i doing wrong?
>
>         [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide  
> http://www.R-project.org/posting-guide.htmland provide commented,  
> minimal, self-contained, reproducible code.

 

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Chaid Decision Tree

2016-08-22 Thread Achim Zeileis

On Mon, 22 Aug 2016, MIKE DE LA HOZ wrote:



Hi,


I am running a chaid tree using titanic dataset (see attachment)



setwd("C:/Users/miguel")

titanic <- read.csv("train.csv")
titanic.s <- subset( titanic, select = -c(PassengerId, Name ) )

ctrl <- chaid_control(minsplit = 20, minbucket = 5, minprob = 0)
chaidTitanic <- chaid(Survived ~ ., data = titanic, control = ctrl)



It looks like I get the following error

Error: is.factor(x) is not TRUE



can you please help me here? I am not able to follow this type of error. if you 
can rewrite the sentence for me, It will be much appreciated


To be able to apply the chaid() function all variables (both response and 
predictor) need to be categorical variables, i.e., in R of class "factor".


It is not clear which variables are the culprits here because your example 
is not reproducible. I guess that there are at least some numeric 
regressor variables. Maybe the "Survived" response is also in numeric 
dummy coding rather than the appropriate "factor" variable.


In any case, I would recommend to use a tree model that can deal with both 
kinds of regressor variables. If you want something that selections split 
variables and split points based on statistical tests, ctree() from 
package "partykit" would be the obvious candidate.




Thanks


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Loop over folder files

2016-08-22 Thread Juan Ceccarelli Arias
Hi
I need to apply some code over some stata files that are in folder.
I've wrote this

library(foreign)

fuente=list.files("C:/Users/Jceccarelli/Bases/Stata", pattern="dta$",
full.names=FALSE)

for (i in 1:length(fuente)){

xxx=read.dta(fuente[i], to.data.frame=TRUE)


}

But i get this error

Error in read.dta(fuente[i], to.data.frame = TRUE) :
  unused argument (to.data.frame = TRUE)

What am i doing wrong?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Lemmatization with WORDNET package

2016-08-22 Thread BHANUMATHI H M
Sir I am working on classification project before that i have to do feature
selection process. i am very interested to apply lemmatization rather
stemming. So i executed the code below according to definition of
lemmatization it should give root words like run for running and ran, think
for thought etc... but my code is not giving correct output.. could you
please Please help me to finding out where actually i went wrong please
sir..

CODE:

library("tm")
library("NLP")
library("wordnet")
setDict("C:/Program Files/WordNet/2.1/dict")
vector.documents <- c("The children something to the playground The cars %s
down the avenue")
corpus.documents <- Corpus(VectorSource(vector.documents))

initDict("C:/Program Files/WordNet/2.1/dict")
lapply(corpus.documents,function(x){
  sapply(unlist(strsplit(as.character(x),"[[:space:]]+")), function(word) {
x.filter <- getTermFilter("StartsWithFilter", word, TRUE)
x.filter
x
terms<- getIndexTerms("NOUN",1,x.filter)
terms
if(!is.null(terms)) sapply(terms,getLemma)
  })
})

OUTPUT:
$`1`
$`1`$The
[1] "the absurd"

$`1`$children
NULL

$`1`$playing
[1] "playing"

$`1`$playground
[1] "playground"

$`1`$The
[1] "the absurd"

$`1`$cars
[1] "carson"

$`1`$landing
[1] "landing"

$`1`$avenue
[1] "avenue"




I also tried by applying other POS and type like "Containsfilter"
 but that also not worked please please help me !!!


Thanks in advance.

with regards,

BHANUMATHI H M

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] problem concernig Survsplit, package survival

2016-08-22 Thread Wollschlaeger, Daniel
Thanks for bringing this issue in the book's description of survSplit() to my 
attention. It seems the change to the behavior of survSplit() was introduced in 
survival version 2.39-2. Up to (including) version 2.38-3, no formula was 
required if arguments 'end' and 'event' were specified.

A corrected pdf of the chapter is available at 
http://dwoll.de/r/gddmr/09_survival.pdf

Daniel Wollschlaeger

On August 19, 2016 4:21:31 AM PDT, "Vinzenz Völkel via R-help"  wrote:
>Dear R-help-community,
>
> 
>
>I hope, that?s the appropiate channel to post a quastion?
>
> 
>
>For some days I have been struggling with a problem concerning the
>?survSplit?-function of the package ?survival?. Searching the internet
>I
>have found a pretty good -German- description of Daniel Wollschläger
>describing how to use survSplit:
>
> 
>
>(https://books.google.de/books?id=9G4oBgAAQBAJ
>wollschl%C3%A4ger+survsplit=bl=ajPgInB83d=noQIAXMWe6oQJ-LwsTC
>kroWdwHQ=de=X=0ahUKEwiqwoX8q83OAhVlM5oKHSMGDrEQ6AEIHjAA#v=onepage&
>q=daniel%20wollschl%C3%A4ger%20survsplit=false>
>=PA345=PA345=daniel+wollschl%C3%A4ger+survsplit=bl=ajPg
>InB83d=noQIAXMWe6oQJ-LwsTCkroWdwHQ=de=X=0ahUKEwiqwoX8q83OAhVlM
>5oKHSMGDrEQ6AEIHjAA#v=onepage=daniel%20wollschl%C3%A4ger%20survsplit=fal
>se
>
> 
>
>Mr. Wollschl?ger also provides the dataset, all of the code he used and
>an
>excerpt of his output:
>
> 
>
> 
>
>> library(survival) # f?r survSplit()
>
>> dfSurvCP <- survSplit(dfSurv, cut=seq(30, 90, by=30), end="obsT",
>
>+ event="status", start="start", id="ID", zero=0)
>
># sortiere nach Beobachtungsobjekt und linken Intervallgrenzen
>
>> idxOrd <- order(dfSurvCP$ID, dfSurvCP$start)
>
>> head(dfSurvCP[idxOrd, ], n=7)
>
>obsTstatus sex  X IVstart ID
>
>1  300  f   -1.3130607 A 0
>1
>
>181  600  f   -1.3130607 A 30
>1
>
>361  631  f   -1.3130607 A 60
>1
>
>10111  f   -1.2282824 A 0
>10
>
>100  271  m -0.1018403 B 0
>100
>
>101  300  m -0.4079027 B 0
>101
>
>281  421  m -0.4079027 B 30
>101
>
> 
>
> 
>
>Unfortunaltely when I tried to copy Mr. Wollschl?gers operations using
>his
>very dataset, RStudio just returned the following error-message:
>
> 
>
>> dfSurvCP2 <-
>survSplit(dfSurv,cut=seq(30,90,by=30),end="obsT",event="status",start="start
>",id="ID",zero=0)
>
>Error in formula.default(eval(parse(text = x, keep.source =
>FALSE)[[1L]])) :
>
>
>  invalid formula
>
> 
>
>I tried to figure out what?s wrong, but so far didn?t find any
>solutions? I
>would be very glad if anyone could help me out here.
>
> 
>
>vhfv
>
> 
>
>
>   [[alternative HTML version deleted]]
>
>
>
>
>
>__
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] persp fail with non-equidistant dates

2016-08-22 Thread Duncan Murdoch

On 22/08/2016 11:17 AM, Tomas Bayer wrote:

Hello,
when I plotted non-equidistant data in 3D (using persp and contour), it
was ended with the same error message:


persp(y, x, z, xlab="latitude", ylab="longitude", zlab="altiude",

main="Altitude")
Error in persp.default(y, x, z, xlab = "latitude", ylab = "longitude",  :
  increasing 'x' and 'y' values expected

How to fix it? The original data are in columns

 50.8492514.65715 614.0  48909.14   -62.49  99  48929  5  122306
 50.8491914.65702 617.0  48816.32  -145.82  69  48836  6  122331
 50.8490814.65681 622.0  49113.40 6.64  99  49133  4  122442


You haven't shown us what is in y, x and z, but it looks as though you 
haven't got data in the form required by persp, i.e. a vector of 
increasing values in each of the first two arguments, and a matrix of 
values in the third.  Using your variable names, you'd want z[i,j] to 
correspond to y[i] and x[j].


If you just have a collection of (y, x, z) triples, you'll need to do 
some pre-processing to fit a surface and produce the required inputs.


Duncan Murdoch

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Estimated Effects Not Balanced

2016-08-22 Thread Bert Gunter
Please!

"when I compute the anova R reports
that the Estimated Effects are Unbalanced"


It does *not* say this. It says that they **may** be unbalanced. They are not.

-- Bert
Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Mon, Aug 22, 2016 at 8:15 AM, Justin Thong  wrote:
> Something does not make sense in R. It has to do with the question of
> balance and unbalance.
>
> *A<-factor(c(1,1,1,1,1,1,2,2,2,2,2,2))*
> *B<-factor(c(1,1,2,2,3,3,1,1,2,2,3,3))*
> *y<-rnorm(12)*
> *mod<-aov(y~A+B)*
>
> I was under the impression that the design is balanced ie order does not
> effect the sums of squares. However, when I compute the anova R reports
> that the Estimated Effects are Unbalanced. I thought that when all
> combinations of levels of A and B have equal replications then the design
> is called balanced. But, R tends to think that when not all levels of A and
> levels of B have equal replication, then the "Estimated Effects are
> unbalanced" Is this the same as the design being unbalanced? Because
> for the example below, where the error occured, the order does not matter
> (which make me think that the design is balanced).
>
>
> *Call:*
> *   aov(formula = y ~ A + B)*
>
> *Terms:*
> *A B Residuals*
> *Sum of Squares   0.872572  0.025604 16.805706*
> *Deg. of Freedom 1 210*
>
> *Residual standard error: 1.296368*
> *Estimated effects may be unbalanced*
> --
> Yours sincerely,
> Justin
>
> *I check my email at 9AM and 4PM everyday*
> *If you have an EMERGENCY, contact me at +447938674419(UK) or
> +60125056192(Malaysia)*
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] persp fail with non-equidistant dates

2016-08-22 Thread Tomas Bayer
Hello,
when I plotted non-equidistant data in 3D (using persp and contour), it
was ended with the same error message:

> persp(y, x, z, xlab="latitude", ylab="longitude", zlab="altiude",
main="Altitude")
Error in persp.default(y, x, z, xlab = "latitude", ylab = "longitude",  :
  increasing 'x' and 'y' values expected

How to fix it? The original data are in columns

 50.8492514.65715 614.0  48909.14   -62.49  99  48929  5  122306
 50.8491914.65702 617.0  48816.32  -145.82  69  48836  6  122331
 50.8490814.65681 622.0  49113.40 6.64  99  49133  4  122442

Tomas Bayer
  ,   ,
 / \
((__-^^-,-^^-__))
 `-_---' `---_-'
  `--|o` 'o|--'
 \  `  /
  ): :(
  :o_o:
   "-"
GNU's Not Unix!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Estimated Effects Not Balanced

2016-08-22 Thread Justin Thong
Something does not make sense in R. It has to do with the question of
balance and unbalance.

*A<-factor(c(1,1,1,1,1,1,2,2,2,2,2,2))*
*B<-factor(c(1,1,2,2,3,3,1,1,2,2,3,3))*
*y<-rnorm(12)*
*mod<-aov(y~A+B)*

I was under the impression that the design is balanced ie order does not
effect the sums of squares. However, when I compute the anova R reports
that the Estimated Effects are Unbalanced. I thought that when all
combinations of levels of A and B have equal replications then the design
is called balanced. But, R tends to think that when not all levels of A and
levels of B have equal replication, then the "Estimated Effects are
unbalanced" Is this the same as the design being unbalanced? Because
for the example below, where the error occured, the order does not matter
(which make me think that the design is balanced).


*Call:*
*   aov(formula = y ~ A + B)*

*Terms:*
*A B Residuals*
*Sum of Squares   0.872572  0.025604 16.805706*
*Deg. of Freedom 1 210*

*Residual standard error: 1.296368*
*Estimated effects may be unbalanced*
-- 
Yours sincerely,
Justin

*I check my email at 9AM and 4PM everyday*
*If you have an EMERGENCY, contact me at +447938674419(UK) or
+60125056192(Malaysia)*

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Intercept in Model Matrix (Parameters not what I expected)

2016-08-22 Thread Bert Gunter
Justin:

As you have not yet received any reply...

Your question is mostly about statistics (linear models) and, as such,
is typically off topic here. Briefly, you do seem confused about
contrasts in linear models, but I am confused about your confusion,
and so may be of little help. However

Note that in your little 8 run example design, the response lives in 8
dims, and so your model matrix can have at most 8 independent columns.
~(A+B) has 4, which, using contr.treatment treatments could be
Intercept, A2,B2, B3 (since (B3+B4) - (B2+B1) is confounded with (A2 -
A1), where these are "dummy" encodings of 0 and 1). Adding all
pairwise products of the non-intercept columns  would not give you any
more, as all are all 0's. I do not know the algorithm that lm/aov uses
to choose which of the contrasts to estimate, but it makes no
difference: there can only be 3 beyond the intercept, and all others
are linear combinations of these.

If this is not useful to you, either:

1. Hope for a response here that is more helpful;
2. Consult a local statistical expert;
3. Read up on linear models (there are multiple books and internet sources);
4. Post on stats.stackexchange.com again.

Cheers,
Bert

## Note to others. If I have erred in any of the above, PLEASE CORRECT.




Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Sun, Aug 21, 2016 at 6:44 PM, Justin Thong  wrote:
> I have something which has been bugging me and I have even asked this on
> cross validated but I did not get a response.  Let's construct a simple
> example. Below is the code.
>
> A<-gl(2,4) #factor of 2 levels
> B<-gl(4,2) #factor of 4 levels
> df<-data.frame(y,A,B)
>
> As you can see, B is nested within A.
> The peculiar result I am interested in the output of the model matrix when
> I fit for a nested model . *How does R decide what is included inside the
> intercept?* Since we are using dummy coding, the coefficients of the model
> is interpreted as the difference between a particular level and the
> reference level/the intercept for an single factor model. I understand for
> model ~A, A1 becomes the intercept and that for model ~A+B, A1 and B1
> (both) become the intercept.
>
> *I do not get why when we use a nested model, A1:B2 appears as a column
> inside the model matrix. Why isn't the first parameter of the interaction
> subspace A1:B1 or A2:B1? *I think I am missing the concept. I think the
> intercept is A1. *Hence, Why do we not compare the levels of A1:B1 and
> A1(intercept)  or A2:B1 and A1(intercept)?*
>
> #nested model
>> mod<-aov(y~A+A:B)
>> model.matrix(mod)
>   (Intercept) A2 A1:B2 A2:B2 A1:B3 A2:B3 A1:B4 A2:B4
> 1   1  0 0 0 0 0 0 0
> 2   1  0 0 0 0 0 0 0
> 3   1  0 1 0 0 0 0 0
> 4   1  0 1 0 0 0 0 0
> 5   1  1 0 0 0 1 0 0
> 6   1  1 0 0 0 1 0 0
> 7   1  1 0 0 0 0 0 1
> 8   1  1 0 0 0 0 0 1
>
>
> --
> Yours sincerely,
> Justin
>
> *I check my email at 9AM and 4PM everyday*
> *If you have an EMERGENCY, contact me at +447938674419(UK) or
> +60125056192(Malaysia)*
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.xlsx function crashing R Studio

2016-08-22 Thread Hadley Wickham
Or readxl.

Hadley

On Mon, Aug 22, 2016 at 5:54 AM, jim holtman  wrote:
> try the openxlsx package
>
>
> Jim Holtman
> Data Munger Guru
>
> What is the problem that you are trying to solve?
> Tell me what you want to do, not how you want to do it.
>
> On Sun, Aug 21, 2016 at 1:30 PM, Kevin Kowitski 
> wrote:
>
>> Hey everyone,
>>
>>I have used read.xlsx in the past rather than XLConnect for importing
>> Excel data to R.  However, I have been finding now that the read.xlsx
>> function has been causing my R studio to Time out.  I thought it might be
>> because the R studio I had was out of date so I installed R studio X64
>> 3.3.1 and reinstalled the xlsx package but it is still failing.  I have
>> been trying to use XLConnect in it's place which has been working, excpet
>> that I am running into memory error:
>>   Error: OutOfMemoryError (Java): GC overhead limit exceeded
>>
>> I did some online searching and found an option to increase memory:
>>   "options(java.parameters = "-Xmx4g" )
>>
>> but it resulted in this new memory Error:
>>
>>  Error: OutOfMemoryError (Java): Java heap space
>>
>> Can anyone provide me with some help on getting the read.xlsx function
>> working?
>>
>> -Kevin
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posti
>> ng-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 
http://hadley.nz

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] problem concernig Survsplit, package survival

2016-08-22 Thread Therneau, Terry M., Ph.D.


On 08/20/2016 05:00 AM, Vinzenz wrote:

For some days I have been struggling with a problem concerning the
?survSplit?-function of the package ?survival?. Searching the internet I
have found a pretty good -German- description of Daniel Wollschl?r
describing how to use survSplit:


The survSplit routine was recently updated to allow a formula as the first argument.  This 
change makes the routine much easier to use and more flexible.  Old forms of the call 
should have worked as well, but unfortunately I introduced a bug in the code.  For the 
time being, change your call to
   dfSurvCP <- survSplit(Surv(obsT, status) ~ ., dfSurv, cut=seq(30, 90, by=30), id="ID", 
zero=0)


I will fix this.  I apologize for the error.

Terry Therneau

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.xlsx function crashing R Studio

2016-08-22 Thread jim holtman
try the openxlsx package


Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

On Sun, Aug 21, 2016 at 1:30 PM, Kevin Kowitski 
wrote:

> Hey everyone,
>
>I have used read.xlsx in the past rather than XLConnect for importing
> Excel data to R.  However, I have been finding now that the read.xlsx
> function has been causing my R studio to Time out.  I thought it might be
> because the R studio I had was out of date so I installed R studio X64
> 3.3.1 and reinstalled the xlsx package but it is still failing.  I have
> been trying to use XLConnect in it's place which has been working, excpet
> that I am running into memory error:
>   Error: OutOfMemoryError (Java): GC overhead limit exceeded
>
> I did some online searching and found an option to increase memory:
>   "options(java.parameters = "-Xmx4g" )
>
> but it resulted in this new memory Error:
>
>  Error: OutOfMemoryError (Java): Java heap space
>
> Can anyone provide me with some help on getting the read.xlsx function
> working?
>
> -Kevin
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posti
> ng-guide.html
> and provide commented, minimal, self-contained, reproducible code.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R-es] Eliminar for de multiplicación de matriz

2016-08-22 Thread Carlos Ortega
Hola,

Se me pasó comentarte que para este caso, no veo forma de eliminar el bucle.
De todas formas, por ver si tú que conoces lo que buscas solucionar, mira
si la función "Vectorize()" te pudiera optimizar un tanto el código...


Saludos,
Carlos Ortega
www.qualityexcellence.es

El 18 de agosto de 2016, 15:42, Sebastian Kruk 
escribió:

> Hola Carlos.
> Lo que pasa es que yo parto de la situación inicial y con esos datos voy
> generando los datos en forma encadenada.
> En verdad el script que mandé está simplificado.
> Cada individuo le pide prestado en cada período al individuo de mayores
> ingresos y el de mayores ingresos incrementa sus ingresos por las deudas de
> los demás individuos.
> Espero si el otro mail que mande con el nuevo script se entienda más.
> Saludos,
> Sebastián.
> --
>
> Message: 1
> Date: Mon, 15 Aug 2016 21:13:31 +0200
> From: Carlos Ortega 
> To: Sebastián Kruk 
> Cc: Lista R 
> Subject: Re: [R-es] Eliminar for de multiplicación de matriz
> Message-ID:
>  ail.com>
> Content-Type: text/plain; charset="UTF-8"
>
>
> Hola,
>
> Puedes hacerlo con data.table, salvo el detalle del "if".
> Suponiendo que tu data.frame es de esta forma:
>
> tu_df <- data.frame(
> hrs_trab = ... ,
> coste_hr = ,
> deuda =,
> periodo   =
>  )
>
> Mencionas hacer una agrupación por "período" pero no lo incluyes en tu
> bucle.
> Dependiendo del tipo de este periodo si es una fecha, mes, semana, etc.
> habría que detallarlo un poco más.
> Pero con esa estructura con data.table es bastante inmediato:
>
> library(data.table
> tu_dt <- as.data.table(tu_df)
> tu_dt[ , Ingreso := hrs_trab * coste_hr - deuda, by="periodo"]
>
>
> Y para el "if", lo que haces en el bucle es sumar 1000 unidades cuando el
> valor es negativo.
> No sé si te valdría si al final del cálculo del data.table anterior, al
> valor negativo de "Ingreso" le sumaras las 1000 unidades de esta forma:
>
> tu_dt$Ingreso <- ifelse(tu_dt$Ingreso < 0 , tu_dt$Ingreso + 1000,
> tu_dt$Ingreso)
>
> Para acertar algo más a la primera, convendría que para este tipo de casos,
> incluyeras una parte de la matriz/data.frame con el que trabajas...
>
>
> Saludos,
> Carlos Ortega
> www.qualityexcellence.es
>
> El 16 de agosto de 2016, 07:00, 
> escribió:
>
>> Envíe los mensajes para la lista R-help-es a
>> r-help-es@r-project.org
>>
>> Para subscribirse o anular su subscripción a través de la WEB
>> https://stat.ethz.ch/mailman/listinfo/r-help-es
>>
>> O por correo electrónico, enviando un mensaje con el texto "help" en
>> el asunto (subject) o en el cuerpo a:
>> r-help-es-requ...@r-project.org
>>
>> Puede contactar con el responsable de la lista escribiendo a:
>> r-help-es-ow...@r-project.org
>>
>> Si responde a algún contenido de este mensaje, por favor, edite la
>> linea del asunto (subject) para que el texto sea mas especifico que:
>> "Re: Contents of R-help-es digest...". Además, por favor, incluya en
>> la respuesta sólo aquellas partes del mensaje a las que está
>> respondiendo.
>>
>>
>> Asuntos del día:
>>
>>1. Re: Eliminar for de multiplicación de matriz (Carlos Ortega)
>>2. inscrición (Boanerge salas muñoz)
>>3. Re: inscrición (javier.ruben.marcu...@gmail.com)
>>
>>
>> --
>>
>> Message: 1
>> Date: Mon, 15 Aug 2016 21:13:31 +0200
>> From: Carlos Ortega 
>> To: Sebastián Kruk 
>> Cc: Lista R 
>> Subject: Re: [R-es] Eliminar for de multiplicación de matriz
>> Message-ID:
>> > ail.com>
>> Content-Type: text/plain; charset="UTF-8"
>>
>>
>> Hola,
>>
>> Puedes hacerlo con data.table, salvo el detalle del "if".
>> Suponiendo que tu data.frame es de esta forma:
>>
>> tu_df <- data.frame(
>> hrs_trab = ... ,
>> coste_hr = ,
>> deuda =,
>> periodo   =
>>  )
>>
>> Mencionas hacer una agrupación por "período" pero no lo incluyes en tu
>> bucle.
>> Dependiendo del tipo de este periodo si es una fecha, mes, semana, etc.
>> habría que detallarlo un poco más.
>> Pero con esa estructura con data.table es bastante inmediato:
>>
>> library(data.table
>> tu_dt <- as.data.table(tu_df)
>> tu_dt[ , Ingreso := hrs_trab * coste_hr - deuda, by="periodo"]
>>
>>
>> Y para el "if", lo que haces en el bucle es sumar 1000 unidades cuando 

Re: [R-es] PROMEDIO POR INTERVALOS

2016-08-22 Thread Carlos Ortega
Hola,

Yo crearía una columna adicional donde incluiría un string con la fecha y
si el intervalo.
Y luego sobre esa columna calcularía los promedios que buscas.

Para lo primero como tienes que trabajar sobre fechas, utilizaría el
paquete "lubridate" que te simplifica mucho la forma de hacerlo.

Y para el cálculo de medias, utilizando esa variable creada con los
intervalos utilizaría el paquete "data.table".

De todas formas, todo esto que harías, es repetir la funcionalidad que ya
te ofrece el paquete "openair" que ya te recomendé en una consulta anterior.

Saludos,
Carlos Ortega
www.qualityexcellence.es

El 22 de agosto de 2016, 6:24, javier valdes 
escribió:

> HOLA a TODOS.
> tengo la siguiente tabla de datos como ejemplo:
>
> FECHAHORA minutos   Pp. temperatura
> 2-2-2014 00:10  1 13
> 2-2-2014 00:20  1 13,5
> 2-2-2014 00:30  1 13,4
>
> tengo los datos cada diez minutos.
> La idea es obtener: promedio DIARIO por intervalos, es decir; el
> promedio de las temperaturas de las (00:00 - 08:00 -14:00 -20:00)
> o, por otro lado, obtener el promedio DIARIO, entre la temperatura
> mìnim y maxima del dia.
> DEbo ocupar MEANS? pero como se construiria el MEANS, SOLO PARA ESOS
> INTERVALOS para cada dia? debo crear subsets?
>
> El resultado final que se busca, es la temperatura MEDIA MENSUAL ,
> extraido del analisis anterior.
>
> Gracias y saludos a todos.
>
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>



-- 
Saludos,
Carlos Ortega
www.qualityexcellence.es

[[alternative HTML version deleted]]

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


Re: [R] I had 1 problem with r

2016-08-22 Thread peter dalgaard

On 22 Aug 2016, at 07:06 , 정수빈  wrote:

> Hi My name is SuBin-Jung from Korea.
> 
> I can't write english well. so, understand me please.
> 
> I used R Gui(64-bit) program.
> 
> And in program, I imported this csv file named "emp.csv"
> 
> emp.csv
> -
> empno,ename,job,mgr,hiredate,sal,comm,deptno
> 7369,SMITH,CLERK,7902,1980-12-17,800,,20
> 7499,ALLEN,SALESMAN,7698,1981-02-20,1600,300,30
> 7521,WARD,SALESMAN,7698,1981-02-03,1250,500,30
> 7566,JONES,MANAGER,7839,1981-03-02,2975,,20
> 7654,MARTIN,SALESMAN,7698,1981-10-22,1250,1400,30
> 7698,BLAKE,MANAGER,7839,1981-05-01,2850,,30
> 7782,CLARK,MANAGER,7839,1981-09-06,2450,,10
> 7788,SCOTT,ANALYST,7566,1982-12-08,3000,,20
> 7839,KING,PRESIDENT,,1981-11-17,5000,,10
> 7844,TURNER,SALESMAN,7698,1984-10-08,1500,,30
> 7876,ADAMS,CLERK,7788,1983-01-12,1100,,20
> 7900,JAMES,CLERK,7698,1981-12-03,950,,30
> 7902,FORD,ANALYST,7566,1981-12-13,3000,,20
> 7934,MILLER,CLERK,7782,1982-01-25,1300,,10
> --
> 
> Then I used command "read.csv"  == read.csv("emp.csv")
> 
> And I tried to find emp$ename with first alphabet 'A'.
> 
> So I inserted this command on program :
> 
>  subset(emp, ename==grep("^A+",ename,value=TRUE), 
> select=c("ename","sal")) 
> 
> But the result is not found.
> 
> After that I tried to other alphabets( B,S,W)
> 
>  subset(emp, ename==grep("^S+",ename,value=TRUE), select=c("ename","sal"))
> 


Please do not post in HTML (reason should be pretty obvious).

Your logic is wrong: 

ename==grep("^A+",ename,value=TRUE)

Right hand side evaluates to c("ALLAN","ADAMS"); you then compare this to 
ename, which by recycling means that you compare 

SMITH to ALLAN, 
ALLAN to ADAMS, 
WARD to ALLAN, 
JONES to ADAMS,
...
TURNER to ADAMS,
ADAMS to ALLAN
...


See?

subset(emp, grepl("^A+",ename), select=c("ename","sal")) 

should work (and is simpler, too)

-pd


> Then I can find two data.
> 
>  ename  sal
> 1 SMITH  800
> 8 SCOTT 3000
> 
> 
> Why can't I find emp$ename with first alphavet 'A'??
> I think this is error. 
> Please give me answer, sir. 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] I had 1 problem with r

2016-08-22 Thread Jim Lemon
Hi SuBin,
This seems to work:

emp<-read.table(text="empno,ename,job,mgr,hiredate,sal,comm,deptno
 7369,SMITH,CLERK,7902,1980-12-17,800,,20
 7499,ALLEN,SALESMAN,7698,1981-02-20,1600,300,30
 7521,WARD,SALESMAN,7698,1981-02-03,1250,500,30
 7566,JONES,MANAGER,7839,1981-03-02,2975,,20
 7654,MARTIN,SALESMAN,7698,1981-10-22,1250,1400,30
 7698,BLAKE,MANAGER,7839,1981-05-01,2850,,30
 7782,CLARK,MANAGER,7839,1981-09-06,2450,,10
 7788,SCOTT,ANALYST,7566,1982-12-08,3000,,20
 7839,KING,PRESIDENT,,1981-11-17,5000,,10
 7844,TURNER,SALESMAN,7698,1984-10-08,1500,,30
 7876,ADAMS,CLERK,7788,1983-01-12,1100,,20
 7900,JAMES,CLERK,7698,1981-12-03,950,,30
 7902,FORD,ANALYST,7566,1981-12-13,3000,,20
 7934,MILLER,CLERK,7782,1982-01-25,1300,,10",
 header=TRUE,sep=",")

emp[grep("^A",emp$ename),c("ename","sal")]
  ename  sal
2  ALLEN 1600
11 ADAMS 1100

Jim


On Mon, Aug 22, 2016 at 3:06 PM, 정수빈  wrote:
> Hi My name is SuBin-Jung from Korea.
>
> I can't write english well. so, understand me please.
>
> I used R Gui(64-bit) program.
>
> And in program, I imported this csv file named "emp.csv"
>
> emp.csv
> -
> empno,ename,job,mgr,hiredate,sal,comm,deptno
> 7369,SMITH,CLERK,7902,1980-12-17,800,,20
> 7499,ALLEN,SALESMAN,7698,1981-02-20,1600,300,30
> 7521,WARD,SALESMAN,7698,1981-02-03,1250,500,30
> 7566,JONES,MANAGER,7839,1981-03-02,2975,,20
> 7654,MARTIN,SALESMAN,7698,1981-10-22,1250,1400,30
> 7698,BLAKE,MANAGER,7839,1981-05-01,2850,,30
> 7782,CLARK,MANAGER,7839,1981-09-06,2450,,10
> 7788,SCOTT,ANALYST,7566,1982-12-08,3000,,20
> 7839,KING,PRESIDENT,,1981-11-17,5000,,10
> 7844,TURNER,SALESMAN,7698,1984-10-08,1500,,30
> 7876,ADAMS,CLERK,7788,1983-01-12,1100,,20
> 7900,JAMES,CLERK,7698,1981-12-03,950,,30
> 7902,FORD,ANALYST,7566,1981-12-13,3000,,20
> 7934,MILLER,CLERK,7782,1982-01-25,1300,,10
> --
>
> Then I used command "read.csv"  == read.csv("emp.csv")
>
> And I tried to find emp$ename with first alphabet 'A'.
>
> So I inserted this command on program :
>
>  subset(emp, ename==grep("^A+",ename,value=TRUE), select=c("ename","sal"))
>
> But the result is not found.
>
> After that I tried to other alphabets( B,S,W)
>
>  subset(emp, ename==grep("^S+",ename,value=TRUE), select=c("ename","sal"))
>
> Then I can find two data.
>
>   ename  sal
> 1 SMITH  800
> 8 SCOTT 3000
>
>
> Why can't I find emp$ename with first alphavet 'A'??
> I think this is error.
> Please give me answer, sir.
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R] I had 1 problem with r

2016-08-22 Thread 정수빈
Hi My name is SuBin-Jung from Korea.
 
I can't write english well. so, understand me please.
 
I used R Gui(64-bit) program.
 
And in program, I imported this csv file named "emp.csv"
 
emp.csv
-
empno,ename,job,mgr,hiredate,sal,comm,deptno
7369,SMITH,CLERK,7902,1980-12-17,800,,20
7499,ALLEN,SALESMAN,7698,1981-02-20,1600,300,30
7521,WARD,SALESMAN,7698,1981-02-03,1250,500,30
7566,JONES,MANAGER,7839,1981-03-02,2975,,20
7654,MARTIN,SALESMAN,7698,1981-10-22,1250,1400,30
7698,BLAKE,MANAGER,7839,1981-05-01,2850,,30
7782,CLARK,MANAGER,7839,1981-09-06,2450,,10
7788,SCOTT,ANALYST,7566,1982-12-08,3000,,20
7839,KING,PRESIDENT,,1981-11-17,5000,,10
7844,TURNER,SALESMAN,7698,1984-10-08,1500,,30
7876,ADAMS,CLERK,7788,1983-01-12,1100,,20
7900,JAMES,CLERK,7698,1981-12-03,950,,30
7902,FORD,ANALYST,7566,1981-12-13,3000,,20
7934,MILLER,CLERK,7782,1982-01-25,1300,,10
--
 
Then I used command "read.csv"  == read.csv("emp.csv")
 
And I tried to find emp$ename with first alphabet 'A'.
 
So I inserted this command on program :
 
 subset(emp, ename==grep("^A+",ename,value=TRUE), select=c("ename","sal")) 
 
But the result is not found.
 
After that I tried to other alphabets( B,S,W)
 
 subset(emp, ename==grep("^S+",ename,value=TRUE), select=c("ename","sal"))
 
Then I can find two data.
 
  ename  sal
1 SMITH  800
8 SCOTT 3000


Why can't I find emp$ename with first alphavet 'A'??
I think this is error. 
Please give me answer, sir. 

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] read.xlsx function crashing R Studio

2016-08-22 Thread Kevin Kowitski

Hey everyone, 

   I have used read.xlsx in the past rather than XLConnect for importing Excel 
data to R.  However, I have been finding now that the read.xlsx function has 
been causing my R studio to Time out.  I thought it might be because the R 
studio I had was out of date so I installed R studio X64 3.3.1 and reinstalled 
the xlsx package but it is still failing.  I have been trying to use XLConnect 
in it's place which has been working, excpet that I am running into memory 
error:
  Error: OutOfMemoryError (Java): GC overhead limit exceeded
  
I did some online searching and found an option to increase memory:
  "options(java.parameters = "-Xmx4g" )

but it resulted in this new memory Error:

 Error: OutOfMemoryError (Java): Java heap space

Can anyone provide me with some help on getting the read.xlsx function working?

-Kevin

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.