read.table() returns a data.frame by default.  Try str(x).  Options:

d1 <- density(x[[1]], kernel = "gaussian")

or

x <- scan("07a673ac0cb1f7f8fa293860566f633c/1/raw0.txt")

Hope this helps

Allan.



On 21/07/09 11:09, leo mueller wrote:
> hi all,
>
> i have a simple question. instead of defining my measurements in a
> static way like ...
>
> x<- c(-0.475, -1.553, -0.434, -1.019, 0.395)
>
> ... i'd like them to be read from a file ...
>
> x<- read.table("07a673ac0cb1f7f8fa293860566f633c/1/raw0.txt", header=FALSE)
> d1<- density(x, kernel = "gaussian")
>
> with a formatting that looks like:
>
> 4.2840000000e-01
> 6.7583333333e-01
> 8.2920000000e-01
> 7.8566666667e-01
> 6.6336666667e-01
> 5.4080000000e-01
> 4.7283333333e-01
> 4.3770000000e-01
> 4.3743333333e-01
> 4.1026666667e-01
> 3.6283333333e-01
> 3.2770000000e-01
> 4.9096666667e-01
> [...]
>
> R quits and says:
>
>    
>> d1<- density(x, kernel = "gaussian")
>>      
> Error in density.default(x, kernel = "gaussian") :
>    argument 'x' must be numeric
> Calls: density ->  density.default
> Execution halted
>
> is there any possibility to convert this / make this work?
>
> big thx for help
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>    

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

Reply via email to