如何加载R中的google trend包

时间:2016-10-18 17:40:39

标签: r install.packages google-trends

我想在R中使用谷歌趋势,但它甚至不会加载包。 我尝试使用类似帖子中的几个解决方案来修复它:

  1. Error in loadNamespace(name) : there is no package called 'Rcpp'

  2. lib unspecified & Error in loadNamespace

  3. 以下是代码:

    ALTER TABLE

3 个答案:

答案 0 :(得分:0)

你的机器上有一些混乱。虽然我参与了这两个软件包,但gtrendsR并非(直接)依赖于Rcpp

您可以通过点击上面的链接看到取决于:和进口:

您可以尝试的一件事是加载gtrendsR依赖的各种软件包,查看错误所在的位置。

CRAN上的所有软件包都是,您可以毫无困难地将机器分类。

答案 1 :(得分:0)

您需要点击R

的安装命令
from flask import Flask, session, redirect, url_for, escape, request, render_template

import os
import base64
import mysql.connector
import base64




app = Flask(__name__)

if __name__ == '__main__':
    db = mysql.connector.connect(host="mounika.cb3d7dg2fmod.us-east-1.rds.amazonaws.com",
                         user="mounika", password="mounika2061993", database="innodb")
    cur = db.cursor()
    app.secret_key = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'


class ServerError(Exception):pass



@app.route('/login', methods=['GET', 'POST'])
def login():

    error = None
    try:
        if request.method == 'POST':
            username_form  = request.form['username']
            data=cur.execute("select count(1) from users1 where username=%s",[username_form])
            print data
            if not cur.fetchone()[0]:
                raise ServerError('Invalid username')

            password_form  = request.form['password']
            print "SELECT password FROM users1 WHERE username=%s",[username_form]
            data1=cur.execute("SELECT password FROM users1 WHERE username=%s",[username_form])

            #print data1

            for row in cur.fetchall():
                if password_form== row[0]:
                    session['username'] = request.form['username']
                    return render_template('images.html', error=error)

            raise ServerError('Invalid password')
    except ServerError as e:
        error = str(e)



    except ServerError as e:
        error = str(e)

    return render_template('index.html', error=error)





@app.route('/')
def index():

    return render_template('index.html')


@app.route('/upload',methods=['POST'])
def uploaddownload():
    username_session = escape(session['username'])
    print username_session
    get_files=request.files.get('file')

    extension=os.path.splitext(get_files.filename)[1]
    print extension
    file_name = os.path.splitext(get_files.filename)[0]
    new_file_name=file_name+extension
    #dir_path = os.path.abspath(new_file_name)
    #print dir_path
    print "hi"
    print new_file_name
    print get_files

    print file_name

    app.config['UPLOAD_FOLDER'] = './static/Uploads'
    get_files.save(os.path.join(app.config['UPLOAD_FOLDER'], new_file_name))
    path=app.config['UPLOAD_FOLDER']+'/'+new_file_name
    print "path"
    print path
    print "file saved succesfully to local upload folder"
    extension_list=['.jpg','.jnpg','.jpeg','.png','.GIF','.BMP','.JPG','.JPNG']
    if(extension in extension_list):
        # print "hiiiiiiiii"

        sql ="INSERT INTO images1 (user_name,images) VALUES(%s,%s)"
        args=(session['username'],path,)
        data= cur.execute(sql,args)
        db.commit()

    return render_template("images.html")

@app.route('/list_files',methods=['POST'])

def list_Files():
    sql1="select images from images1"
    cur.execute(sql1)
    data= cur.fetchall()
    print data
    file_name_list=[]
    for file in data:
        #file_name_list.append(file.generate_url(3600,query_auth=False,force_http=True))
        file_name_list.append(file[0].strip('.'))
        print  file_name_list
        #print file.name
    return render_template("images.html",list_names=file_name_list)

@app.route('/delete<filename>')
def delete(filename):
    print "Hi"

    return render_template("index.html")






if __name__ == '__main__':
    app.run(debug=True)

安装后..

答案 2 :(得分:0)

在 Mac 上,运行下面的命令并成功。

install.packages("readr")
install.packages("colorspace")
install.packages("vctrs")
install.packages("gtrendsR")