将向量有效地转换为专用列表

时间:2018-10-15 15:47:16

标签: r

我正在寻找一种的有效方法,将当前输入转换为预期输出。

输入

${Build::DefinitionName}

预期产量

package com.abdullah.md.allsimoffers;

import android.content.Intent;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ProgressBar;
import android.widget.Toast;

import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.InterstitialAd;
import com.google.android.gms.ads.MobileAds;

public class MainActivity extends AppCompatActivity {

    ProgressBar progressBar;
    int setValue;
    private InterstitialAd interstitialAd;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
        WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_main);
        getSupportActionBar().hide();

        MobileAds.initialize(this,"ca-app-pub-3940256099942544~3347511713");
        progressBar = findViewById(R.id.progressBar);

        interstitialAd = new InterstitialAd(MainActivity.this);
        interstitialAd.setAdUnitId(getString(R.string.interstitial_ad_unit_id));
        interstitialAd.loadAd(new AdRequest.Builder().build());

        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                interstitialAd.setAdListener(new AdListener() {

                    @Override
                    public void onAdLoaded() {
                        runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                Toast.makeText(MainActivity.this, "Ads", Toast.LENGTH_SHORT).show();
                                interstitialAd.show();
                            }
                        });
                        super.onAdLoaded();
                    }

                    @Override
                    public void onAdClosed() {
                        goToFirstActivity();
                        super.onAdClosed();
                    }

                    @Override
                    public void onAdFailedToLoad(int i) {
                        goToFirstActivity();
                        super.onAdFailedToLoad(i);
                    }
                });
            }
        }, 5500);

        final Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                startProgressing();
            }
        });
        thread.start();
    }

    private void goToFirstActivity() {
        Intent intent = new Intent(MainActivity.this, FirstActivity.class);
        startActivity(intent);
    }

    private void startProgressing() {
        for (setValue = 10; setValue <= 100; setValue += 20) {
            progressBar.setProgress(setValue);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}

当前解决方案:

vec <- 1:4

1 个答案:

答案 0 :(得分:1)

我们可以做到

def phenotype(n):
    """creates the phenotype"""
    phenotype_simple = 2 * pop['alpha'] + pop['beta']
    return phenotype_simple