将数据框中的列拆分为bin类别

时间:2015-05-28 10:09:40

标签: r

我有一个如下所示的数据集:

user_avgfrequency$avgfrequency <- cut(user_frequency$avgfrequency,                         
breaks=quantile(user_avgfrequency$avgfrequency, probs = seq(0,370, 10)))

我正在尝试将avgfrequency分成不同的bin类别。我尝试使用剪切功能:

public class CustomAdapter extends PagerAdapter{

Context context;
int[] imageId = {R.drawable.slider1, R.drawable.slider2};
String[] caption = { "1", "2" };

public CustomAdapter(Context context){
    this.context = context;
}

@Override
public Object instantiateItem(ViewGroup container, int position) {
    // TODO Auto-generated method stub

    LayoutInflater inflater = ((Activity)context).getLayoutInflater();

    View viewItem = inflater.inflate(R.layout.image_item, container, false);
    ImageView imageView = (ImageView) viewItem.findViewById(R.id.imageView);
    TextView textView = (TextView) viewItem.findViewById(R.id.textView1);
    imageView.setImageResource(imageId[position]);
    textView.setText(caption[position]);
    ((ViewPager)container).addView(viewItem);

    return viewItem;
}

@Override
public int getCount() {
    // TODO Auto-generated method stub
    return imageId.length;
}

@Override
public boolean isViewFromObject(View view, Object object) {
    // TODO Auto-generated method stub

    return view == ((View)object);
}


@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    // TODO Auto-generated method stub
    ((ViewPager) container).removeView((View) object);
}

}

但是收到错误。

这可以用更简单的方式完成吗?

0 个答案:

没有答案