
The following is the related code and the metadata.I have tried my best to modify and test but the error always happened.I really don't know what it means. Please check it form me.
Thanks in advance.
Regards

Date: Sun, 15 Jul 2012 23:26:57 -0700
From: ml-node+s789695n4636611h98@n4.nabble.com
To: chester123@live.cn
Subject: Re: About dpik function



	On 15/07/2012 19:57, chester123 wrote:

> Hi there and thanks in advance.

>

> Nowadays I am working on the plug-in bandwidth selection with R. Firstly, my


So why use package KernSmooth and not the methods in R itself?


> 1010 data is the return rate from Yahoo Finance.

> Secondly, my code is following:

>> r=read.table("/Users/user/Desktop/research/a.txt",sep=",",header=TRUE)

>> x<-r[8:1010,]

>> library(KernSmooth)

>> dpik(x,scalest="minim",level=2L,kernel="normal",canonical=FALSE,gridsize=401L,range.x=range(x),truncate=TRUE)

>

> But the error happens like this:

> Error in Summary.factor(c(233L, 917L, 381L, 748L, 272L, 242L, 269L, 963L,  :

>    range not meaningful for factors

>

> I don't know what's wrong and i am a rookie, please help with that. Thanks!

So what is 'x'?  We don't know (your code is not reproducible), but it 

sure looks like a factor.  And from the help:


        x: vector containing the sample on which the kernel density

           estimate is to be constructed.


A factor is not a vector (in this sense).


> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


PLEASE do as you were asked.



-- 

Brian D. Ripley,                  [hidden email]

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, UK                Fax:  +44 1865 272595


______________________________________________

[hidden email] 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.


	
	

	

	
	
		If you reply to this email, your message will be added to the discussion below:
		http://r.789695.n4.nabble.com/About-dpik-function-tp4636590p4636611.html
	
	
		
		To unsubscribe from About dpik function, click here.

		NAML
	 		 	   		  

--
View this message in context: http://r.789695.n4.nabble.com/About-dpik-function-tp4636590p4636625.html
Sent from the R help mailing list archive at Nabble.com.
	[[alternative HTML version deleted]]

