如何查找和安装包,找不到“对象'插入符'

时间:2018-02-15 11:32:11

标签: r installation packages

我正在使用R 3.4.3并且无法安装插入符号包(Error in install.packages(caret) : object 'caret' not found)。我已经尝试了其他存储库和CRAN镜像。我尝试过安装github和遥控器以及devtools但没有运气。我如何安装此软件包?我尝试了install.packages(“caret”),并出现以下错误消息:install.packages(“caret”)中的警告:   'lib =“C:/ Program Files / R / R-3.4.3 / library”'不可写 install.packages(“插入符号”)出错:无法安装软件包。我有互联网连接,并尝试从菜单安装没有运气。

2 个答案:

答案 0 :(得分:2)

您需要“引号”

package ge.softservice.photobucket;

import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.List;

import ge.softservice.photobucket.controller.RestManager;
import ge.softservice.photobucket.model.CalendarPojo;
import ge.softservice.photobucket.model.Printing;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;


/**
 * A simple {@link Fragment} subclass.
 * Activities that contain this fragment must implement the
 * {@link CalendarFragment.OnFragmentInteractionListener} interface
 * to handle interaction events.
 * Use the {@link CalendarFragment#newInstance} factory method to
 * create an instance of this fragment.
 */
public class CalendarFragment extends Fragment {
    // TODO: Rename parameter arguments, choose names that match
    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";

    // TODO: Rename and change types of parameters
    private String mParam1;
    private String mParam2;

    private OnFragmentInteractionListener mListener;
    protected RecyclerView recyclerView;
    protected MyCalendarRecyclerViewAdapter myCalendarRecyclerViewAdapter;
    RecyclerView.LayoutManager layoutManager;
    RestManager mManager;


    public CalendarFragment() {
        // Required empty public constructor
    }

    /**
     * Use this factory method to create a new instance of
     * this fragment using the provided parameters.
     *
     * @param param1 Parameter 1.
     * @param param2 Parameter 2.
     * @return A new instance of fragment NavCalendarFragment.
     */
    // TODO: Rename and change types and number of parameters
    public static CalendarFragment newInstance(String param1, String param2) {
        CalendarFragment fragment = new CalendarFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, param1);
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mParam1 = getArguments().getString(ARG_PARAM1);
            mParam2 = getArguments().getString(ARG_PARAM2);
        }

        mManager = new RestManager();
        Call<List<CalendarPojo>> listCall = mManager.getGalleryImageService().getCalendarImages();
        listCall.enqueue(new Callback<List<CalendarPojo>>() {
            @Override
            public void onResponse(Call<List<CalendarPojo>> call, Response<List<CalendarPojo>> response) {
                if (response.isSuccessful()) {
                    List<CalendarPojo> calendarList = response.body();

                    for (int i = 0; i <calendarList.size() ; i++) {
                        CalendarPojo calendar = calendarList.get(i);
                        myCalendarRecyclerViewAdapter.addCalendarImages(calendar);
                    }
                }
                else {
                    int sc = response.code();
                    switch (sc) {

                    }
                }
            }

            @Override
            public void onFailure(Call<List<CalendarPojo>> call, Throwable t) {

            }
        });
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.calendar_fragment, container, false);
        myCalendarRecyclerViewAdapter = new MyCalendarRecyclerViewAdapter();
        recyclerView = (RecyclerView) rootView.findViewById(R.id.calendar_recycler_view);
/*        RecyclerView.LayoutManager layoutManager = new GridLayoutManager(getActivity()
                .getApplicationContext(), 2);*/
        layoutManager = new GridLayoutManager(getActivity().getApplicationContext(), 3);
        recyclerView.setAdapter(myCalendarRecyclerViewAdapter);
        recyclerView.setHasFixedSize(true);
        recyclerView.setLayoutManager(layoutManager);
        recyclerView.setRecycledViewPool(new RecyclerView.RecycledViewPool());
        // Inflate the layout for this fragment
       // return inflater.inflate(R.layout.calendar_fragment, container, false);
        return rootView;
    }

    @Override
    public void onResume() {
        super.onResume();

        ( (AppCompatActivity)getActivity()).getSupportActionBar().setTitle(R.string.calendars);
    }

    // TODO: Rename method, update argument and hook method into UI event
    public void onButtonPressed(Uri uri) {
        if (mListener != null) {
            mListener.onFragmentInteraction(uri);
        }
    }

/*    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        if (context instanceof OnFragmentInteractionListener) {
            mListener = (OnFragmentInteractionListener) context;
        } else {
            throw new RuntimeException(context.toString()
                    + " must implement OnFragmentInteractionListener");
        }
    }*/

    @Override
    public void onDetach() {
        super.onDetach();
        mListener = null;
    }

    /**
     * This interface must be implemented by activities that contain this
     * fragment to allow an interaction in this fragment to be communicated
     * to the activity and potentially other fragments contained in that
     * activity.
     * <p>
     * See the Android Training lesson <a href=
     * "http://developer.android.com/training/basics/fragments/communicating.html"
     * >Communicating with Other Fragments</a> for more information.
     */
    public interface OnFragmentInteractionListener {
        // TODO: Update argument type and name
        void onFragmentInteraction(Uri uri);
    }
}

并使用它

document.getElementById('ELEtextDate').value;

答案 1 :(得分:1)

因为你错过了“插入符号”周围的引号

install.packages("caret") # RIGHT - use a string name
install.packages(caret)   # WRONG - it thinks caret is some string variable containing the name of the actual package

老答案   - 从命令行或GUI从CRAN安装应该可以工作,但如果由于某种原因它不可能(可能是您的内部网,连接或网络安全),您可以......   - 下载tarball(使用wget / browser / ftp)然后按照Install R Packages without internet继续   - 另请参阅How should I deal with “package 'xxx' is not available (for R version x.y.z)” warning? 了解后备内容(从源代码编译,使用旧版本等)。