原创 Linux window 中文字符 目錄 亂碼 問題 解決方案

step 1 更換ls命令爲du命令: du -sh * step 2 利用mv 修改亂碼文件名字爲英文名字(中間不可以有空格): mv 中文名字 english_name

原创 R語言 class() mode() typeof() 查看函數的區別

R語言 數據屬性查看方法 class() #查看數據結構:vector、matrix、array、dataframe、list mode() #查看數據元素類型: typeof() #查看數據元素類型,基本等同於m

原创 R語言 c()函數 官方 說明文檔

需要注意的是,cbind() 和rbind() 是考慮dim 特性的連接函數,而函數c() 則不考慮這些數值對象的dim 和dimnames 屬性。這一點在有些時候非常有用。將一個數組強制轉換成簡單向量的標準方法是用函數as.ve

原创 Error: (list) object cannot be coerced to type 'double'

Error: (list) object cannot be coerced to type 'double’的問題解決方案 > data5b2<-as.numeric(data5b1) Error: (list) object

原创 read.table字符值T變爲 邏輯值TRUE的解決方法

等處理鹼基序列文件時,如果一整列全爲“T”鹼基,則R語言默認爲邏輯值TRUE,如果讀取時,設置colClasses = “character”,則讀取結果爲字符型“T” ped<-read.table("combind_ped.p

原创 Linux 文本 列數 統計

Linux 文本 列數統計 方法一:(非等列數據統計) $cat 1.txt | awk '{print NF}' 4 4 4 方法二:(前提是等列數據表) $cat 1.txt | awk '

原创 sort()、order()、rank()函數的區別

sort()、order()、rank()函數的區別 命令: x=c(1,10,3,6,5) x sort(x) x order(x) x rank(x) 運行結果: > x=c(1,10,3,6,5) > x [1]

原创 R語言 循環 步長 寫法

for(i in seq(9, 108, by=2)){ #9爲起始值,108爲終止值,2爲步長 print(i) }

原创 Python pandas 數據框 按列值 篩選數據(單值篩選,按照列表多值篩選)

** 目標1:從d0數據框中,篩選出rs列中包含 '2_161686082’中值的數據框 ** d1 = d0.loc[d0['rs']=='2_161686082'] d1 ** 目標2:從d0數據框中,篩選出rs列中包含 *

原创 shell編程 for語句

for循環實例1: #!/bin/bash s=0 for((i=1;i<=100;i++)) do s=$[$s+$i] done echo $s for循環實例2(命令後加參數): #!/bin/

原创 shell編程 case函數 書寫格式

#!/bin/bash case $1 in 1) echo "xiong da" ;; 2) echo "xiong er" ;; *) echo "guang tou qiang"

原创 shell編程 自定義函數 書寫格式

#!/bin/bash function sum() { s=$[$1+$2] echo $s } read -p "input your first number: " P1 read -p "inp

原创 python 數據處理 list serise dataframe ndarray dict tuple之間的相互轉化

import numpy as np import pandas as pd ########### Series ########### Series <--> DataFrame *dataframe* = pd.DataFra

原创 shell編程 while 語句

#!/bin/bash s=0 i=1 while [ $i -le 100 ] #條件語句 [] 內部保留空格 do s=$[$s + $i] #計算語句 [] 內部不保留空格 i=$[$i + 1

原创 shell編程 read函數的使用

#!/bin/bash read -t 99 -p "input your name " NAME #-t等待時間 ;-p提示信息; 賦值給NAME echo $NAME