Dear Nezahat
In future it would be helpful if you

1 - gave us the data so we can reproduce what you are doing
2 - told us what the error was in case we cannot replicate ti
3 - did not post in HTML as it messes up everything in your post

What did you think x1 <- numeric was going to do?
Try
x1 <- numeric
str(x1)


On 28/05/2015 22:16, Nezahat HUnter wrote:

Let's say I have 12 observation of 5 variables and my first variable is categorical (with 
4 different levels). I am trying to find out statistical significance difference between 
these categorical levels for each variable, but my  function is not working! Please note 
that my data "x" are in data.frame format.
Any suggestion would be helpful.Many thanks.

function(x)
{
     x1 <- numeric
     x2 <- numeric
     for(i in 2:length(x)) {
         x1[i] <- summary(aov(x[, i] ~ factor(x[, 1])))
         x2[i] <- x1[i]$Pr[1]  #Pr is the probability values
         if(x2[i] < 0.06)
             x2[i] <- 1
         else x2[i] <- 0
     }
     x2
}




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


--
Michael
http://www.dewey.myzen.co.uk/home.html

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

Reply via email to