Friday, May 27, 2011

itouch 越狱

1. iOS4.3.3 越狱http://bbs.weiphone.com/read-htm-tid-1914526.html

2. 越狱完成后安装ipa补丁

添加CYDIA源,CYDIA->MANAGE->SOURCES->添加 http://app.weiphone.com/cydia/      接着点更新源,

CYDIA->Sections->补丁->IPA补丁(OS 4.x),安装即可

3. 下载IPA用itunes更新

4. 安装terminal:http://yhfan.blogspot.com/2011/05/mobileterminal-installation.html

4. 安装OPENSSH, 从cydia search ssh,安装openssh即可

Thursday, May 26, 2011

MobileTerminal installation

Easy Install (using Cydia auto-install)

This method is the easiest and fastest, recommended for novices.
  1. Launch Cydia on your device, and allow it to fully load up.
  2. Now tap on the ”Manage” tab on the bottom, then tap on “Sources” located in the middle.
  3. Once your sources have loaded, tap “Edit” at the top right, then “Add” at the top left.
  4. Lastly, enter http://YourCydiaRepo.org and tap “Add Source”.
  5. Allow Cydia to do the rest of the work.
  6. Now that you have added this repository, do a search for "MobileTerminal", and download it from Your Cydia Repo
source: http://code.google.com/p/mobileterminal/wiki/Installation

Monday, May 23, 2011

纸币折戒指教程

1.首先将纸币对折.(随便一面都可以)

2.在上面往下折一条大约为0.5~1CM既边. 此条边的大小.决定心形的大小.

3.翻面,对折 

4.沿对折线,折角

5.另一边一样,折角  


6.折完之后.反过来.在最顶上.折一下..大约为1CM~1.5CM。 (折的这个长度是心形的长度)

7.折好后.翻面.

8.将左右两边分别由下往上折 .

9.左右两边都折上去 

10.之后在同一面.将刚刚才折好的部分.再由上往下折 

11.也是左右两边都要折的 

12.当你完成以上的步骤.你就可以将整张纸币拿起来.由后往前折一写波纹..这些波纹大约为0.5CM.(这个波纹的厚度.是戒指宽度)

13.最后一步.就是将它围着手指卷..当然.你首先要了解你送送的人的手指有多大.围好后.你就可以用透明胶贴好

14.完成图~(这个是用10港币折的)

Source:http://www.zwmao.com/zhezhi/001/11655924193584_3.html

English

After you. 您先。
Allow me. 让我来。
Any day will do. 哪一天都行夕
Any messages for me? 有我的留言吗?
Any thing else? 还要别的吗?
Any urgent thing? 有急事吗?
Are you kidding? 你在开玩笑吧!
Are you sure? 你肯定吗?
As soon as possible! 越快越好!
Absence makes the heart grow fonder. 小别胜新婚。
Be careful! 注意!
Be quiet! 安静点!
Believe it or not! 信不信由你!
Between us. 你知,我知。
Big mouth! 多嘴驴!
Blast! 该死,讨厌!
Bless you! 祝福你!
Bottle it! 閉嘴!
Bottoms up! 干杯(见底)!
Boy! (表示惊奇,兴奋等)哇!好家伙!
Break the rules. 违反规则。
Can I have this. 可以给我这个吗?
Can I help you? 我能帮你吗?
Can you dig it? 你搞明白了吗?
Can-do. 能人。
Cheap skate! 小气鬼!
Cheer up! 振作起来!
Chin up. 不气 ,振作些。
Close-up. 特寫鏡頭。
Clothes make the man. 人要衣装。
Come on! 快点,振作起来!
Come on, be reasonable. 嗨,你怎么不讲道理。
Come on. 来吧(赶快)
Come seat here. 来这边坐。
Congratulations! 祝贺你!
Control yourself! 克制一下!
Count me on 算上我。
Daring! 亲爱的!
Dead end. 死胡同。
December heartbeat. 黄昏恋。
Did you miss the bus? 你错过公共汽车了?
Dinner is on me. 晚饭我请。
Do l have to 非做不可吗?
Do me a favor? 帮个忙,好吗?
Do you have any money on you? 你身上带钱了吗?
Do you have straw? 你有吸管吗?
Does it serve your purpose? 对你有用吗?
Doggy bag. 打包袋。
Don't be so childish. 别这么孩子气。
Don't be so modest. 别谦虚了。
Don't count on me.别指望我。
Don't fall for it! 别上当!
Don't flatter me. 过奖了。
Don't get high hat. 别摆架子。
Don't get loaded. 别喝醉了。
Don't get me wrong. 别误会我。
Don't give me that! 少来这套!
Don't let me down. 别让我失望。
Don't let me down. 别让我失望。
Don't lose your head. 不要惊慌失措。
Don't make up a story. 不要捏造事实。
Don't mention it. 没关系,别客气。
Don't move! 不许动!
Don't overdo it. 别太过分了。
Don't play possum! 別裝蒜!
Don't push me. 别逼我。
Don't take ill of me. 别生我气。
Don't trust to chance! 不要碰运气。
Don't worry. 别担心。
Drop it! 停止!
Easy come easy go. 来得容易,去得快。
Easy does it. 慢慢来。
Enjoy yourself! 祝你玩得开心!
Excuse me,Sir. 先生,对不起。
Fasten your seat belt. 系好你的安全带。
Feel better? 好点了吗?
Follow me. 跟我来。
Follow my nose. 凭直觉做某事。
Forget it! 休想! (算了!)
Fresh paint! 油漆未干!
Get an eyeful. 看个够。
Get cold feet. 害怕做某事。
Get out of here! 滚出去!
Gild the lily. 画蛇添足。
Give me a hand! 帮帮我!
Go ahead. 继续。
Go down to business. 言归正传。
Go to hell! 去死吧!
God works. 上帝的安排。
Good for you! 好得很!
Good job! 做得好!
Good luck! 祝你好运!
Guess what? 猜猜看?
Hang on! 抓紧(别挂电话)!
Have a good of it.玩的很高兴。
Have fun! 玩得开心!
He always talks big. 他总是吹牛。
He came by train. 他乘火车来。
He can hardly speak. 他几乎说不出话来。
He can't take a joke. 他开不得玩笑。
He has a quick eye. 他的眼睛很锐利。
He has an ax to grind. 他另有企图。
He is a fast talker. 他是个吹牛大王。
He is a smart boy. 他是个小机灵鬼。
He is ill in bed. 他卧病在床。
He is just a child. 他只是个孩子。
He is my age. 他和我同岁。
He is the pain on neck. 他真让人讨厌。
He lacks courage. 他缺乏勇气。
He neither drinks nor smokes. 他既不喝酒也不抽烟。
He owes my uncle $55.他欠我叔叔55美元。
He pushes his luck. 他太贪心了。
He won an election. 他在选举中获胜。
Help me out. 帮帮我。
Help yourself. 别客气。
Here we are! 我们到了!
Here ye! 说得对!
Here you are. 给你。
High jack! 举起手来(抢劫)!
Hit the ceiling. 大发雷霆。
Hold on. 等一等。
Hope so. 希望如此。
How about eating out? 外面吃饭怎样?
How are things going? 事情进展得怎样?
How are you recently? 最近怎么样?
How big of you! 你真棒!
How come… 怎么回事,怎么搞的。
How much? 多少钱?
How's everything? 一切还好吧?
How's it going? 怎么样?
I agree。 我同意。
I am a football fan. 我是个足球迷。
I am all ears. 我洗耳恭听。
I am the one wearing pants in the house. 我当家。
I beg your pardon. 请你原谅。
I beg your pardon? 请您再说一遍(我没有听清)。
I can't follow you. 我不懂你说的。
I can't make both ends meet. 我上个月接不到下个月,缺钱。
I decline! 我拒绝!
I don't care. 我不在乎。
I don't have anywhere to be. 没地方可去。
I don't mean it. 我不是故意的。
I doubt it 我怀疑。
I felt sort of ill. 我感觉有点不适。
I have a good idea! 我有一个好主意。
I have no choice. 我别无选择。
I have no idea. 我没有头绪。
I hate to be late and keep my date waiting. 我不喜欢迟到而让别人久等。
I just made it! 我做到了!
I know all about it. 我知道有关它的一切。
I like ice-cream. 我喜欢吃冰淇淋。
I lost my way. 我迷路了。
I love this game. 我钟爱这项运动。
I love you! 我爱你!
I might hear a pin drop. 非常寂静。
I promise. 我保证。
I quit! 我不干了!
I see. 我明白了。
I stay at home a lot. 我多半在家里。
I swear by the god. 我对天发誓。
I think so. 我也这么想。
I wonder if you can give me a lift? 能让我搭一程吗?
If only I could fly. 要是我能飞就好了。
I'll be back soon. 我马上回来。
I'll be right there. 我马上就到。
I'll be seeing you. 再见。
I'll check it out. 我去查查看。
I'll fix you up. 我会帮你打点的。
I'll get even with him one day. 我总有一天跟他扯平
I'll kick you out. 我将炒你鱿鱼。撵走,开除。
I'll see to it 我会留意的。
I'll see you at six. 我六点钟见你。
I'll try my best. 我尽力而为。
I'm afraid I can't. 我恐怕不能。
I'm bored to death. 我无聊死了。
I'm dying to see you. 我很想见你。
I'm full. 我饱了。
I'm going to go. 我這就去。
I'm his fan。 我是他的影迷。
I'm home. 我回来了。
I'm in a hurry! 我在赶时间!
I'm lost. 我迷路了。
I'm not going. 我不去了。
I'm not in a good mood. 没有心情(做某事)。
I'm on a diet. 我在节食。
I'm on your side. 我全力支持你。
I'm single. 我是单身贵族。
Is it true or false? 这是对的还是错的?
Is it yours? 这是你的吗?
Is that so? 是这样吗?
It can be a killer. 这是个伤脑筋的问题。
It doesn't make any differences. 没关系。
It doesn't take much of you time. 这不花你好多时间。
It doesn't work. 不管用。
It is a deal! 一言为定!
It is a long story. 一言难尽。
It is a small world! 世界真是小!
It is growing cool. 天气渐渐凉爽起来。
It is not a big deal! 没什么了不起!
It is of high quality. 它质量上乘。
It is raining. 要下雨了。
It is urgent. 有急事。
It really takes time. 这样太耽误时间了。
It seems all right. 看来这没问题。
It sounds great!. 听起来很不错。
It was something that happens once in the blue moon. 这是千载难逢的事。
It’s a long story. 说来话长。
It’s Sunday today. 今天是星期天。
It's a fine day。 今天是个好天。
It's against the law. 这是违法的。
It's going too far. 太离谱了。
It's her field. 这是她的本行。
It's up in the air. 尚未确定。
It's up to you. 由你决定。
It's up to you. 由你决定。
Just read it for me. 就读给我听好了。
Just wait and see! 等着瞧!
Just wonderful! 简直太棒了!
Keep in touch. 保持联络。
Keep it up! 坚持下去!
Knowledge is power. 知识就是力量。
Leave me alone. 别理我。
Let go! 放手!
Let me see.让我想想。
Let's bag it. 先把它搁一边。
Let's play it by ear. 让我们随兴所至。
Long time no see! 好久不见!
Lose head. 丧失理智。
Love me,love my dog. (谚语)爱屋及乌。
Make it up! 不记前嫌!
Make it. 达到目的,获得成功。
Make up your mind. 做个决定吧。
May I use your pen? 我可以用你的笔吗?
Me too. 我也是。
Move out of my way! 让开!
My girlfriend and I broke up. 我和我的女朋友吹了。
My god! 天哪!
My hands are full right now. 我现在很忙。
My mouth is watering. 我要流口水了。
My treat. 我请客。
Never mind. 不要緊。 
No one knows . 没有人知道。
No pain,no gain. 不劳无获。
No problem! 没问题!
No way! 不可能!
No way! 不行!
None of my business. 不关我事。
None of your keyhole. 不准偷看。
Not at all. 根本就不(用)。
Not bad. 还不错。
Not in the long run. 从长远来说不是这样的。
Not precisely! 不见得,不一定!
Not so bad. 不错。
Not yet. 还没。
Nothing tricky. 别耍花招。
Nuts! 呸;胡说;混蛋!
Of course! 当然了!
Play hooky. 旷工、旷课。
Poor thing! 真可怜!
Price is soaring, if it goes on like this, we shall not be able to keep the pot boiling. 物价直线上升,这样子下去,我们锅里可没什么东西煮饭。
Right over there. 就在那里。
Say hello to everybody for me. 替我向大家问好。
See you. 再见。
She had a bad cold. 她患了重感冒。
She is still mad at me. 她还在生我的气。
She make a mess of things. 她把事情搞得一塌糊涂。
She'll be along in a few minutes. 他马上会过来。
She's got quite a wad. 她身怀巨款。
Shoot the breeze. 闲谈。
Shut up! 闭嘴!
Side dish. 配菜。
Sleeping on both ears. 睡的香。
Slow down! 慢点!
So do I. 我也一样。
So far,So good. 目前还不错。
So long. 再见。
Speak louder,please. 说话请大声点儿。
Stay away from him. 别接近他。
Still up? 还没睡呀?
Sure thing! 當然!
I can't help it. 我情不自禁。
Take a seat! 请坐!
Take care! 保重!
Take it easy. 别紧张。
Talk truly. 有话直说。
Tell me when! 随时奉陪!
That is a boy! 太好了,好极了!
That is great! 太棒了!
That is unfair. 这不公平!
That rings a bell. 听起来耳熟。
That's a good idea. 这个主意真不错。
That's all I need. 我就要这些。
That's all! 就这样!
That's neat. 这很好。
The answer is zero. 白忙了。
The line is engaged. 占线。
The view is great. 景色多么漂亮!
The wall has ears. 隔墙有耳。
There comes a bus. 汽车来了。
There is nobody by that name working here. 这里没有这个人。
They hurt. (伤口)疼。
This boy has no job. 这个男孩没有工作。
This house is my own. 这所房子是我自己的。
This way。 这边请。
Thousand times no! 绝对办不到!
Time is money. 时间就是金钱。
Time is running out. 没时间了。
Time is up. 时间快到了。
To be careful! 一定要小心!
Try again. 再试试。
Wait and see. 等着瞧。
Watch out! 当心。
Watch you mouth. 注意言辞。
We are good friends. 我们是好朋友。
We have no way out. 我们没办法。
Well,it depends 噢,这得看情况。
We're all for it. 我们全都同意。
What a good deal! 真便宜!
What a pity! 太遗憾了!
What about you? 你呢?
What brought you here? 什么风把你吹来了?
What day is today? 今天星期几?
What do you think? 你怎么认为?
What does she like? 她喜欢什么?
What happened to you? 你怎么了?
What if I go for you? 我替你去怎么样?
What is the fuss? 吵什么?
What is you major? 你学什么专业?
What should I do? 我该怎么办?
What time is it? 几点了?
What's new? 有什么新鲜事吗?
What's up? 有什么事吗?
What's your trouble? 你哪儿不舒服?
When are you leaving? 你什么时候走?
Who knows! 天晓得!
Who told you that? 谁告诉你的?
Who wants? 谁稀罕?
Who's calling? 是哪一位?
Who's kicking off? 现在是谁在开球?
Why are you so sure? 怎么这样肯定?
Why die she marry a man old enough to be her father? 她为什么要嫁给一个年龄与她父亲相当的男人?
Why not? 好呀! (为什么不呢?)
Why so blue? 怎么垂头丧气?
Would you mind making less noise? 能不能小声点。
Yes,I suppose so. 是的,我也这么认为。
You are just in time. 你来得正是时候。
You are welcome! 别客气!
You ask for it! 活该!
You asked for it! 你自讨苦吃!
You bet! 一定,当然!
You can make it! 你能做到!
You can't miss it 你一定能找到的。
You did fairly well! 你干得相当不错
You did right. 你做得对。
You don't say so. 未必吧,不至于这样吧。
You don't say! 真想不到!
You don't seem to be quite yourself today. 你今天看起来不大对劲。
You have my word. 我保证。
You might at least apologize. 你顶多道个歉就得了。
You need to workout. 你需要去运动锻炼一下。
You never know. 世事难料。
You owe me one.你欠我一个人情。
You set me up! 你出卖我!
You want a bet? 你想打赌吗?
Your are welcome. 你太客气了。
Your hand feels cold. 你的手摸起来很冷。。
You're welcome. 不客气。
久仰!I've heard so much about you.
好久不见了!Long time no see.
辛苦了!You've had a long day. You've had a long flight.
尊敬的朋友们!Distinguished/Honorable/Respected friends
阁下(多用于称呼大使) Your Excellency
我代表北京市政府欢迎各位朋友访问北京。On behalf of the Beijing Municipal government, I wish to extend our warm welcome to the friends who have come to visit Beijing.
对您的大力协助,我谨代表北京市政府表示衷心的感谢。On behalf of the Beijing Municipal government, i wish to express our heartfelt thanks to you for your gracious assistance.
在北京过得怎么样?How are you making out in Beijing?
我一定向他转达您的问候和邀请。I'll surely remember you and your invitation to him.
欢迎美商来北京投资。American businessmen are welcome to make investment in Beijing.
欢迎多提宝贵意见。Your valuable advice is most welcome.
不虚此行! It's a rewarding trip!
您的日程很紧,我们的会见是否就到此为止。As you have a tight schedule, I will not take up more of your time.
请代我问候王先生。Please remember me to Mr.Wang.
感谢光临!Thank you so much for coming.
欢迎再来!Hope you'll come again.
欢迎以后多来北京!Hope you'll visit Beijing more often.
请留步,不用送了!I will see myself out, please.
多保重!Take care!
祝您一路平安!Have a nice trip!
愿为您效劳!At your service!
为…举行宴会/宴请Host a dinner/banquet/luncheon in honor of …
欢迎宴会Welcome dinner
便宴Informal dinner
午宴(附有情况介绍或专题演讲等内容)Luncheon
便餐Light meal
工作午餐Working luncheon
自助餐 Buffet dinner/luncheon
答谢宴会Return dinner
告别宴会Farewell dinner
庆功宴Glee feast
招待会Reception
庆祝中华人民共和国成立四十五周年招待会Reception Celebrating the 45th Anniversary of the Founding of the People's Republic of China
鸡尾酒会Cocktail party
茶话会Tea party
包餐/点餐Table d'hote/a la carte
上菜Serve a course
您的位置在这里。Here is your seat.
请入席!Please have a seat.
欢聚一堂Enjoy this happy get-together
请随便!Please make yourself at home./Please enjoy yourself.
请各位随意用餐。Help yourself please.
您喝点什么?What would you like to drink?
现在我提议,为了…和…之间的合作,为了…参议员的健康,干杯!At this point, I propose a toast: to the cooperation between … And … , to the health of Senator…, cheers!
最后,我借主人的酒,提议为…干杯!Lastly, taking up this glass of fine wine, I propose a toast to …
请各位举杯并同我一起为所有在座的朋友们的健康干杯!I'd ask you to raise your glass and join me in a toast ot the health of all our friends present here.
敬您一杯!Here's to you!
祝你健康!To your health!
我要为此干杯!I'll drink to that!
随量!Whatever you like!
我失陪一会儿!Excuse me for a minute.
菜不好,请多多包涵!Hope you enjoy yourself.
女士们先生们,欢迎各位光临,演出很快就要开始了,请尽快就坐。Ladies and gentlemen, good evening. The concert/show would start soon. Please get yourself seated. Thank you.
招待会现在开始。The reception will now begin.
全体起立,奏国歌!All rise please. For the P.R.C.National Anthem!
出席今天招待会的贵宾有…The distinguished guests paarticipating the reception are …
现在请…讲话I have the honour to call upon …
开幕式现在结束。This concludes the opening ceremony.
隆重庆祝Grand celebration
庆祝成立…一周年Celebrating the 1st Anniversary of the Establishment of …
热烈祝贺第一届…锦标赛Hail the first FIFA of …
值此节日之际致以节日的祝贺!On the occasion of the season, I would like to extend season's greetings.
祝您工作顺利、事业成功、身体健康、家庭幸福!Wish you the very best of luck in your job, every success in your future endeavours, good health and a happy family!
衷心祝贺您当选…Hearty congratulations on your recent election as …
举行会议/研讨会/大会/座谈会/学术报告会Hold a meeting/seminar/conference/forum/symposium
赞助人/主办人/承办人/协办人Patron/sponsor/organizer/co-organizer
举行谈判Enter into negotiation
交涉Make representations with sb. On sth./deal with sb.
事物性会谈Talks at working level
对口会谈Counterpart talks
议程项目Items on the agenda
主题Theme
议题Topic for discussion
双方商定的议程Schedule mutually agreed upon
开幕会议 Opening session
全体会议Plenary session
开场白Introduction
情况介绍Presentation
小组讨论Panel discussion
同有关单位磋商Hold consultations with the organizations concerned
一轮会谈One round of talks
决议Resolution
谅解备忘录Memorandum of understanding
现在开会。I declare the meeting open.
请…发言。I invite the representative of …To take the floor.
下面我给各位简要介绍一下北京的经济情况Now I would like to give you a brief overview of Beijing's economy.
我的介绍完了,谢谢!That's all for my presentation. thank you.
我先说这么多。So much for my remarks for now.
我要说的就是这些。That's all for what I want to say.
您看是先谈原则问题呢,还是先谈具体问题?I wonder if you would like to start with matters of principle or specific issues?
让我先谈一个问题。If you agree(With your permission), let me start with one issue
在谈那个问题之前我想对您刚才讲的话谈点看法。Before we turn to that issue, I wish to make a few comments/remarks on your presentation.
您对此事怎么看呢?I wish to benefit from your views on this matter./ What is your view on this matter?/ How do you see this matter?
我提议休会十分钟。I propose a ten-minute break.
我想接着刚才的问题讲下去。I will pick up where we left off just now.
对不起,我插一句。Sorry for the interruption but
当然可以!By all means.
怎么都行!Whatever you say.
我没有异议。I have no objection.
我方对这个问题有异议。We take exception to this question.
我们高兴地看到…We note with pleasure that …
这个日期贵方觉得合适吗?I wonder if this date would be suitable for you?
不知你们上午谈的怎样?I wonder how the meeting went this morning?
我方很希望 贵方能尽早给予肯定的答复。We would greatly appreciate it if you could give us your favourable and prompt commitment as soon as possible.
请你们务必在8月1日前提出意向书。You are kindly requested to submit the letter of intent on the date no later than 1st August.
纠缠这个问题。Entangle this issue.
提倡节约Advocate/uphold thriftiness
为了国家的繁荣For the sake of national property
经受了时间考验的友谊给我留下了很深的印象。The time-tested friendship leave me a deep impression.
密切注视Keep close watch on
促进密切合作Spur/promote intensive cooperation
sources: sorry, I can not find the original sources

Sunday, May 22, 2011

Learning R for Researchers

R is a powerful open source environment for statistical computing. This post provides a selective list of resources for getting started with R including thoughts on books, online manuals, blogs, videos, user interfaces, and more. At the end of the post are some R resources specific to researchers in psychology. (UPDATED 4th May 2011)

Getting Started

  • Download and Install R
  • Watch Videos on R:
  • Organise a user interface to R.
    • My general advice is:
    • Spend the first 10 hours using the basic R environment.
    • Then have a look at R Studio
    • Eventually, you may want to transition to a more sophisticated environment, such as:
      • Emacs with ESS: A popular and powerful interface, particularly if you already use Emacs or are considering adopting Emacs
      • If you have standardised on another editor, such as Notepad++ or Vim there are R interfaces available. It is well worth standardising on a powerful text editor, such as Emacs or Vim. I currently use Vim (see here for why I chose Vim).
      • StatET and Eclipse is another full featured environment (download and manual).
    • See this discussion on StackOverflow for more ideas
  • Read some free online documentation
  • Memorise important R commands
  • Stay up to date on R News:
    • Subscribe to the RSS feed of R-Bloggers: It syndicates many, if not most, of the R related posts in the blogosphere.
    • If alternatively you want to follow fewer posts, David Smith tends to post important R news and links to noteworthy blog posts by others.
    • R Journal, formerly called "R News", publishes R related articles.
  • Know how to find answers to your questions
    • Learn how to use built-in documentation (e.g., help, ?, apropos, help.search, etc.)
    • Google is still good (despite the many meanings of the letter "R"). I generally just use it
    • Rseek is an R specific search engine
  • Know where to ask questions to the R community:
    • R Tag on StackOverflow: A good option for anything related to programming in R.
    • Cross Validated: This is part of the Stack Exchange network. This is a good option if the question concerns statistical elements of R.
    • R Help Mailing List: Another option for asking R related questions with many R gurus in attendance.
    • With all these forums a good question will typically be answered within a day.
  • Learn about additional R packages
    • Base R often does most of what you want, but there are thousands of user contributed packages.
    • R Task Views organises the many R packages into various topics.
    • lattice, ggplot2, plyr, nlme are some general packages relevant to a lot of people.
  • Get some good books (free or paid):
    • The question of good books on R was asked on Stack Overflow. In particular, this answer lists several good free online options.
    • The R website lists many of the increasing number books on R that are being released.
    • Some of the books on R that I have enjoyed reading include the following:
      • Software for Data Analysis (2008): John Chambers: This gives a sense of the philosophy and style of programming in R. It is an intermediate to advanced text.
      • Data Manipulation with R: Phil Spector: This book is short, concise, and very clear. The examples are well chosen.
      • Data Analysis and Graphics Using R - An Example-Based Approach: John Maindonald and John Braun: This provides a good introduction to R. It also covers many techniques useful in psychology introducing several interesting techniques that are not necessarily part of the standard psychology statistics curriculum.
      • Books in the ;The Springer UseR Series tend be quite good.
      • But there are many more.
  • Engage with the R community

Additional Resources

The following are some additional R web resources that I have liked over the while.
source: http://jeromyanglim.blogspot.com/2009/06/learning-r-for-researchers-in.html

Automatically Save Your Plots to a Folder

Suppose you're working on a problem that involves a loop for calculations. At each iteration inside the loop, you want to construct a plot. Not only do you want to see the plot, but you would like to save each plot for a presentation, report or paper. Furthermore, the loop goes on for a while (say through the 26-letters of the alphabet).

The last thing you want to do in this situation is: (1) produce each plot one-by-one, (2) right click on each singly-produced plot to save, (3) give the plot a unique name, and (4) repeat. You'll spend too much of your time saving plots and not enough time thinking about whether they are the right plots. Just imagine, what if something went wrong and you need to produce the whole set of plots again?

RStudio has a nice feature in that it saves all of your plots in the plotting pane. It's no problem if you just produce the plot inside your dreaded loop in RStudio because it keeps all of your plots in the pane. Even with RStudio, if you produce the plots inside the loop, you still need to save each one individually. This isn't ideal. If you don't believe me, imagine that you have 1000 plots instead of 26. This manual-saving method becomes impractical quickly.

How then can you automatically save plots to a folder without spending too much time? That's today's task. I'll start by describing several building-block commands and then at the end I'll put together a loop that does it all (by way of contrived example).

The first command you need to know is jpeg() (Alternatively, bmp(), png() or tiff(), depending on your file-type preferences) paired with dev.off(). For our purposes, jpeg() takes a path argument that allows us to save (at the location of our choosing via the path) output to a plotting window. For example, this code will save the next plotting object to a jpeg file called myplot.jpg located at "C://R//SAVEHERE"

jpeg(file = "C://R//SAVEHERE//myplot.jpg")

After running the plotting object, you need to be sure to turn off the plotting device you created (with the jpeg() command). To save a scatter plot of the vectors x versus y to the location described above, run these three lines:

jpeg(file = "C://R//SAVEHERE//myplot.jpg")
plot(x,y)
dev.off()

This code is a good building block for automatically saving to a folder inside a loop, but we still need to know how to dynamically create file names at which to save our plots. Suppose we have a vector that gives us a list of identifiers called names. Presumably, these identifiers mean something in your setting. For our working example, names is a list of letters from A to Z (we are trying to produce a separate scatter plot for each letter from A to Z).

We can use the file.path() and paste() commands to help us out here. I have found paste() to be incredibly useful for other applications as well. For example,

paste("myplot_", i, ".jpg", sep="")

produces the character string myplot_50.jpg when i = 50 and myplot_51.jpg when i=51. If i changes for each iteration in the loop, this paste() command will create a unique file name at each iteration.

We can get fancier with our pasting. If we have a vector of names, we can extract the ith name from the names vector with the paste command:

paste("myplot_", names[i], ".jpg", sep="")

The file.path() function helps us in a different way. It is a special paste function that helps us construct file paths really easily. For example,

mypath=file.path("C:", "R", "SAVEHERE", filename)

returns "C://R//SAVEHERE//filename" and stores it in an object called my path. Replace filename with the paste command and we have a way to automatically generate file names in a folder called SAVEHERE.

Now, you have the tools to understand my example code of how to automatically generate and save plots to a folder. Make sure the folder exists before saving, but subject to that constraint, this procedure may make your life easier.

source: http://novicemetrics.blogspot.com/2011/04/automatically-save-your-plots-to-folder.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+CoffeeAndEconometricsInTheMorning+%28Coffee+and+Econometrics+in+the+Morning%29&utm_content=FaceBook

Bar Graphs in ggplot2

The Setup

Let’s begin by making up some data. This is for a pretend experiment with four participants (labelled “ppt1″, “ppt2″, and so on). They take part at two different time points (Time 1 and Time 2 – cool name or what). Some kind of stimulus is presented to them in different regions in the display. We’ll call these two “Region A” and “Region B”. Their performance is indicated by mean_score. Here is the code to generate some fake data – note the use of randomisation here with rnorm, meaning your means will be different to those I illustrate here:

library(ggplot2)
ppt <- rep(c("ppt1", "ppt2", "ppt3", "ppt4"), 8 )
time<- c(rep("Time 1",8), rep("Time 2",8))
mean_score<-c(rnorm(8, mean=500, sd=20), rnorm(8, mean=250, sd=80))
region <- c(rep("Region A",4), rep("Region B",4),rep("Region A",4), rep("Region B",4))
bar_data<-data.frame(ppt,time, region, mean_score)
This leaves us with a shiny new dataframe called bar_data. 

The Bar Graphs / Bar Charts

Now for the code. What we want to do is take a look at how each participant scored, with their mean_score for each Time and each Region.
bars<-ggplot(bar_data)+
aes(x=region, y=mean_score)+
geom_bar()+
facet_grid(facets=ppt~time)
ggsave(bars, file="bars.png")
We set up the x and y axes using the aes command. geom_bar() draws up the bar chart. Next, all we need is facet_grid which creates a grid-like arrangement for various combinations of the different factor levels in the columns. We specify facets = ppt~time which tells ggplot to draw one bar chart for each level of ppt and time . Finally, ggsave is a handy way to output a high-dpi image straight out to your current working directory. This gives publication-quality plots in an instant. At last, we can rejoice as we find it gives us the following graph:

Monday, May 16, 2011

Linux commands

命令:login
格式:Login: guest [Enter]
 passwd:      [Enter]
功能:登录。注意:强调一点,你输入Password的时候是任何字符都没有显示的
当用户准备退出自己的计算机帐号时可在系统示符下输入logout或exit
passwd  命令修改保密口令,口令通常由此可6到8个字母数字组成。
显示目录
  命令:pwd(print working directory)
  格式:pwd
  功能:显示出用户当前工作目录的全路径名。
  例如:~ pwd
建立目录
  命令:mkdir(make directory)
  格式:mkdir directory_name
  功能:建立新目录
  例如:~ mkdir directory
改变目录
  命令:cd(change directory)
  格式:cd directory_name
  功能:改变当前工作目录
  注释:目录名选项有:
    (1) 目录名,转到当前目录下的子目录。
    (2) .. 表示转到当前目录的父目录。
    (3) / 表示转到根目录。
    (4) 没有选项时,转到用户的主目录。
  例如:~ cd directory
删除目录
  命令:rmdir (remove directory)
  格式:rmdir directory_name
  功能:删除不存在文件的子目录名。
  注释:
    (1) 删除子目录时,要求被删除的目录中不存在文件或子目录,否则无法删除。
    (2) 若被删除的目录中有文件或子目录,请参考命令rm -r directory_name。
  例如:~ rmdir directory
文件操作命令
 列出文件目录
  命令:ls (list)
  格式:ls [option] directory_name
  功能:列出指定目录中的文件名和子目录名。当无子目录名时,列出当前目录中的文件名和子目录名。
  选项:-a列出所有文件,包括以点开头的隐含文件。
      -l按长格式列出文件名,包括文件类型标识,权限,链接数,文件主名,文件组名,字节数,日期。
      -r列出包括子目录下所有文件
      -g在长格式中给出用户组的标识。
      -t安文件生成日期排序。
 显示文件内容   命令:cat (catenae)
  格式:cat filename
  功能:显示出文件的内容。  
  注释:可按Ctrl+S键屏幕滚暂停,按Ctrl+Q  键继续显示。  
  例如:~ cat filename
显示文件头部   命令:head
  格式:head [option] filename
  功能:显示文件的头部  
  选项:缺省 显示文件的头10行。
  -i   显示文件的开始 i行。  
  例如:~ head filename
显示文件尾部   命令:tail
  格式:tail [option] filename
  功能:显示文件的尾部  
  选项:缺省 显示文件的末10行。     
 -i   显示文件最后 i行。      
 +i   从文件的第i行开始显示。  
 例如:~ tail filename
显示格式化的文件内容   命令:pr (print)
  格式:pr filename
  功能:在屏幕上显示格式化的文件内容,即印出每页66行的文本文件,包括5行页头和5行页尾。
  页头包括两行空行,一行含有文件的时间、文件名和页号,另外两行为空行。页尾为5行空行。  
 例如:~ pr filename
拷贝文件   命令:cp (copy)
  格式:cp [option] filename1 filename2
      cp [option] filename... directory
      cp -r directory1 directon2
  功能:把一个文件的全部内容拷贝到另一个文件,也可将一个或多个文件拷贝到另一个目录中。  
  选项:-i 按提示进行拷贝文件。      
  -p 按原文件日期进行拷贝。      
  -r 对子目录下所有文件进行拷贝。  
  注释:当filename1拷贝到filename2时,若filename2已经存在,则filename2的内容将被filename1覆盖。  
  例如:~ cp filename1 filename2
移动文件或文件改名   命令:mv (move)
  格式:mv filename1 filename2
      mv filename... direction
      mv direction1 direction2
  功能:改变文件或目录的名子,或把一些文件移到另一目录下。  
  注释:当filename1更名为filename2时,若filename2已经存在,则filename2的内容将被filename1覆盖  
  例如:~ mv filename1 filename2
删除文件   命令:rm (remove)
  格式:rm filename
      rm -r direction
  功能:删除指定的文件或一个目录中的文件。  
  注释:用-r选项时,将删除指定目录的所用文件,包括目录名。 
  例如:~ rm filename
链接文件   命令:ln (link)
  格式:ln [option] filename linkname
      ln [option] directory pathname
  功能:为文件或目录建立一个链。其中,filename和directory是源文件名和源目录名;
  linkname和pathname分别表示与源文件或源目录名相链接的文件或目录。  
  选项:-s 为文件或目录建立符号链接。  
  注释:链接的目地在于,对一个文件或目录赋予两个以上的名字,使其可以出现在不同的目录中,既可以使文件或目录共享,又可以节省磁盘空间。  
  例如:~ ln -s filename linkname
 
 改变文件读取权限   命令:chmod (change mode)
  格式:chmod {u|g|o|a}{+|-|=}{r|w|x} filename
      chmod [who][op][mode] directory
  功能:改变文件的读写和执行权限。有符号法和八进制数字法。  
  选项:(1)符号法:       u (user)   表示用户本人。       g (group) 表示同组用户。       o (oher)   表示其他用户。       a (all)   表示所有用户。       +       用于给予指定用户的许可权限。       -       用于取消指定用户的许可权限。       =       将所许可的权限赋给文件。       r (read)   读许可,表示可以拷贝该文件或目录的内容。       w (write) 写许可,表示可以修改该文件或目录的内容。       x (execute)执行许可,表示可以执行该文件或进入目录。       (2)八进制数字法:       此方法用三位八进制数作任选项,每位数字分别表示用户本人、同组用户、其他用户的权限,其中:       4 (100)   表示可读。       2 (010)   表示可写。       1 (001)   表示可执行。   注释:   例如:~ chmod a+rx filename
        让所有用户可以读和执行文件filename。       ~ chmod go-rx filename
        取消同组和其他用户的读和执行文件filename的权限。       ~ chmod 741 filename
        让本人可读写执行、同组用户可读、其他用户可执行文件filename。
改变文件所有权   命令:chown (change owner)
  格式:chown username filename
      chown -R username directory
  功能:改变文件或目录的所有权。  
  选项:-R 将改变目录中所有文件及目录的拥有者。  
  注释:只有文件的主人和超级用户才能改变文件的所有权。  
  例如:~ chown username filename
寻找文件   命令:find
  格式:find pathname [option] expression
  功能:在所给的路经名下寻找符合表达式相匹配的文件。  
  选项:-name   表示文件名       -user   用户名,选取该用户所属的文件       -group   组名,选取该用户组属的文件     
  -mtime n 选取n天内被修改的文件       -newer fn 选取比文件名为fn更晚修改的文件  
  注释:   例如:~ find . -name \'*abc*\' –print
 
搜索文件中匹配符   命令:grep
  格式:grep [option] pattern filenames
  功能:逐行搜索所指定的文件或标准输入,并显示匹配模式的每一行。  
  选项:-v      找出模式失配的行       -c      统计匹配行的数量       -n      显示匹配模式的每一行  
  注释:   例如:~ ps -aux | grep R
比较文件不同   命令:diff (difference)
  格式:diff filename1 filename2
  功能:显示两文件的不同之处。   选项:   注释:  
  例如:~ diff file1 file2
比较文件   命令:cmp (compare)
  格式:cmp [-l] [-s] filename1 filename2
  功能:显示比较两文件不同处的信息  
  选项:-l 给出两文件不同的字节数       -s 不显示两文件的不同处,给出比较结果   注释:  
  例如:~ cmp file1 file2
比较文件共同处   命令:comm (common)
  格式:comm [-123] filename1 filename2
  功能:选择或拒绝比较两文件出现的共同行  
  选项:-1 不显示第1列       -2 不显示第2列       -3 不显示第3列  
  注释:输出三列,第一列表示在file1中出现的行,第二列表示在file2中出现的行,第三列表示在file1和file2Z..G.同出现的行。  
  例如:~ comm file1 file2
排序文件   命令:sort
  格式:sort [option] filename
  功能:将制定的文件按要求排序  
  选项:-r 按字母倒排序       -n 按数字的值从笑到大排序       -r 按当前排序规则逆序排序
      -f 不区分大小写排序       -d 按典型顺序排序  
  注释:选项缺省时按ascii码顺序排序   例如:~ sort -nr file
建立档案文件   命令:tar (tape archive)
  格式:tar [option] tarfile filename
  功能:建立文件的存档或读存档文件。  
  选项:-c 建立一个新的档案文件       -x 从档案文件中读取文件       -v 显示处理文件的信息       -f 指定档案文件名,缺省时为磁带机即/dev/rmt/0
      -t 列出存档文件的信息   注释:  
   例如:~ tar cvf tarfile .
      ~ tar xvf tarfile
      ~ tar tvf tarfile
修改文件日期   命令:touch
  格式:touch filenae
  功能:改变文件的日期,不对文件的内容做改动,若文件不存在则建立新文件。  
  选项:   注释:   例如:~ touch file
统计文件字数   命令:wc (word characters)
  格式:wc [option] filename
  功能:统计文件中的文件行数、字数和字符数。  
  选项:-l 统计文件的行数       -w 统计文件的字数       -c 统计文件的字符数  
  注释:若缺省文件名则指标准输入   例如:~ wc file
检查拼写   命令:spell (spelling)
  格式:spell [option] filename ...
  功能:检查文件中的拼写错误   选项:-b 按英国拼法检查       -v 显示字面上不在拼法字典上的词       -x 显示每一个可能合理的词根  
  注释:   例如:~ spell file
有关状态信息命令
显示都有谁登录到机器上 了
命令:who
  格式:who
  功能:显示当前正在系统中的所有用户名字,使用终端设备号,注册时间。  
  例如:~ who
显示当前终端上的用户名   命令:whoami
  格式:whoami
  功能:显示出当前终端上使用的用户。  
  例如:~ whoami
查找非标准命令   命令:which
  格式:which command
  功能:查找非标准命令,即使用别名或系统中标准命令集之外的命令。  
  选项:   注释:   例如:~ which ls
 
显示日期   命令:date
  格式:date
  功能:显示或设置日期和时间。  
  选项:   注释:只有超级用户有权设置日期。   例如:~ date
 
计算命令执行时间   命令:time
  格式:time [command]
  功能:计算程序或命令在执行其间所用的时间。  
  选项:   注释:计算出的时间为:real是命令在系统驻留的总时间,user是命令消耗CPU的时间,sys是命令I/O所开销的时间。  
  例如:~ time myprog
显示用户标识   命令:id
  格式:id [option] [user]
  功能:显示用户标识及用户所属的所有组。  
  选项:-a 显示用户名、用户标识及用户所属的所有组  
  注释:   例如:~ id username
显示主机标识   命令:hostid
  格式:hostid
  功能:显示主机的唯一标识,是被用来限时软件的使用权限,不可改变。  
  选项:   注释:   例如:~ hostid
显示磁盘空间   命令:df (disk free)
  格式:df [option]
  功能:显示磁盘空间的使用情况,包括文件系统安装的目录名、块设备名、总字节数、已用字节数、剩余字节数占用百分比。  
  选项:-i 显示已用和未用的字节数       -k 显示磁盘空间的使用信息  
 
显示文件盘空间   命令:du (disk usage)
  格式:du [option] [filename]
  功能:显示目录或文件所占磁盘空间大小   选项:-a 显示所有文件的大小       -s 显示制定目录所占磁盘大小 
  注释:   例如:~ du
 
显示终端选项   命令:stty
  格式:stty [option]
  功能:显示或设置终端的任选项。   选项:-a 显示所有设置情况       -g 显示当前设置  
  注释:   例如:~ stty –a
显示终端名   命令:tty
  格式:tty
  功能:显示终端名   选项:   注释:   例如:~ tty
回忆命令   命令:history
  格式:history
  功能:帮助用户回忆执行过的命令。   选项:   注释:   例如:~ history
网络命令
显示网络地址   命令:arp
  格式:arp hostname
  功能:显示系统当前访问的远程住机名、IP地址和硬件地址。   选项:-a
  注释:   例如:~ arp –a
显示到网络主机的路经   命令:traceroute
  格式:traceroute hostname
  功能:显示本机到达某一网络主机所经的路经和使用的时间。  
  选项:   注释:   例如:~ traceroute hostname
运行程序命令  
参数回至标准输出   命令:echo
  格式:echo [-n] [arguments]
  功能:将参数即字符串至标准输出即显示器   选项:-n 不向标准输出回送换行符   注释:   例如:echo *
复制至文件   命令:tee
  格式:tee [option] filename
  功能:至标准输出的同时复制至文件   选项:-a 输出时附加到文件中       -i 不理采中断  
  注释:   例如:~ who | tee file
给程序优先级   命令:nice
  格式:nice [-n] command
  功能:以低的优先级运行程序或命令。   选项:-n 为优先级0-20从高到低  
  注释:   例如:nice -5 progame
终止进程   命令:kill
  格式:kill [option] pid
  功能:向指定的进程送信号或终止进程。   选项:-9 强行终止进程       -17 将进程挂起       -19 将挂起的进程激活  
  注释:pid标示进程号,可由ps命令得到。   例如:~ kill -9 pid
进程睡眠   命令:sleep
  格式:sleep time
  功能:使当前正在执行的进程在规定的时间内处于睡眠。   选项:   注释:time为进程将睡眠的时间,以秒为单位。  
  例如:~ sleep time
 
显示作业状态   命令:jobs
  格式:jobs [-l]
  功能:显示当前作业的状态   选项:-l 长列表显示作业状态,包括所有者、作业号、终端和状态。  
  注释:作业状态为 +表示最近被停止的作业,-表示先前的作业,exit 1表示退出的作业,job# done表示已完成的作业。  
  例如:~ jobs
前台作业   命令:fg
  格式:fg job#
  功能:将指定作业号的作业转入前台运行。job#表示作业号。  
  选项:   注释:   例如:~ fg job#
 
后台作业   命令:bg   格式:bg job#      command 
  功能:将指定作业号的作业或命令推到后台运行。  
  选项:   注释:   例如:~ bg job#

more: list file contents

ps: process tracking
telnet: communicate with remote host
gzip/tar/gunzip: file compression/uncompression
nohup: continuous command/script execution
man: search online documentation
echo: expand arguments to STDOUT

ctrl+c: abort a process/script
uniq: extract unique text elements
> filename: save a copy of the output to file
>! filename: overwrite the existing file
cat filename: display a file's contents
cat file1 file2: display multiple file at once
cat file1 file2 ... > outfile: combine multifile

awk:
work best on files that have columns of numbers or strings separated by whitespace (tabs or spaces)

awk '{print $1}' a.txt #print column 1 of a.txt
awk '$5 > 100 {print $1,$5}' a.txt
##print column 1 and 5
##if column 5 greater than 100

grep:
grep keyword filename

by default, grep will print out all lines that match the selection creteria.

e.g. grep gi 1.txt #output lines with "gi"

-i: to make the search case-insensitive
-n: allow the output to be numbered
-c: count how many times a particular term appears within the text

-v: output lines without the term

grep -l gi *.seq

# list the output of all files that have the term "gi" within them

grep "^p" gene.txt

#select all proteins that have a name begining with "p"

free: 内存
df: 硬盘
uname -a: 32/64 bits
ifconfig:ip,mac
top: 实时显示进程状态
join: join lines of two files on a common filed
wget: wget url # download

ssh:
Connecting using an SSH client on Mac OS X or Linux

ssh username@hostname

where username is your SSH username, and hostname is the host name or IP address of your Web server

scp:

scp是secure copy的简写,用于在Linux下进行远程拷贝文件的命令,和它类似的命令有cp,不过cp只是在本机进行拷贝不能跨服务器,而且scp传输是加密的。可能会稍微影响一下速度。

获取远程服务器上的文件

scp -P 2222 root@www.vpser.net:/root/lnmp0.4.tar.gz /home/lnmp0.4.tar.gz

上端口大写P 为参数,2222 表示更改SSH端口后的端口,如果没有更改SSH端口可以不用添加该参数。 root@www.vpser.net 表示使用root用户登录远程服务器www.vpser.net,:/root/lnmp0.4.tar.gz 表示远程服务器上的文件,最后面的/home/lnmp0.4.tar.gz表示保存在本地上的路径和文件名。

获取远程服务器上的目录

scp -P 2222 -r root@www.vpser.net:/root/lnmp0.4/ /home/lnmp0.4/

上端口大写P 为参数,2222 表示更改SSH端口后的端口,如果没有更改SSH端口可以不用添加该参数。-r 参数表示递归复制(即复制该目录下面的文件和目录);root@www.vpser.net 表示使用root用户登录远程服务器www.vpser.net,:/root/lnmp0.4/ 表示远程服务器上的目录,最后面的/home/lnmp0.4/表示保存在本地上的路径。

将本地文件上传到服务器上

scp -P 2222 /home/lnmp0.4.tar.gz root@www.vpser.net:/root/lnmp0.4.tar.gz

e.g. scp example.tar.gz yanhui@147.8.33.227:/home/yanhui/impute/example.tar.gz

上端口大写P 为参数,2222 表示更改SSH端口后的端口,如果没有更改SSH端口可以不用添加该参数。 /home/lnmp0.4.tar.gz表示本地上准备上传文件的路径和文件名。root@www.vpser.net 表示使用root用户登录远程服务器www.vpser.net,:/root/lnmp0.4.tar.gz 表示保存在远程服务器上目录和文件名。

将本地目录上传到服务器上

scp -P 2222 -r /home/lnmp0.4/ root@www.vpser.net:/root/lnmp0.4/

上 端口大写P 为参数,2222 表示更改SSH端口后的端口,如果没有更改SSH端口可以不用添加该参数。-r 参数表示递归复制(即复制该目录下面的文件和目录);/home/lnmp0.4/表示准备要上传的目录,root@www.vpser.net 表示使用root用户登录远程服务器www.vpser.net,:/root/lnmp0.4/ 表示保存在远程服务器上的目录位置。

source: http://www.vpser.net/manage/scp.html
source: http://bbs.weiphone.com/read-htm-tid-566913.html

Tuesday, May 10, 2011

Multiple Y-axis in a R plot

#Create Dataset

time<-seq(7000,3400,-200)
pop<-c(200,400,450,500,300,100,400,700,830,1200,400,350,200,700,370,800,200,100,120)
grp<-c(2,5,8,3,2,2,4,7,9,4,4,2,2,7,5,12,5,4,4)
med<-c(1.2,1.3,1.2,0.9,2.1,1.4,2.9,3.4,2.1,1.1,1.2,1.5,1.2,0.9,0.5,3.3,2.2,1.1,1.2)

#Define Margins. The trick is to use give as much space possible on the left margin (second value)
par(mar=c(5, 12, 4, 4) + 0.1)

plot(time, pop, axes=F, ylim=c(0,max(pop)), xlab="", ylab="",type="l",col="black", main="",xlim=c(7000,3400))
points(time,pop,pch=20,col="black")
axis(2, ylim=c(0,max(pop)),col="black",lwd=2)
mtext(2,text="Population",line=2)
#Plot the first time series. Notice that you don't have to draw the axis nor the labels
#Plot the second time series. The command par(new=T) is handy here. If you just need to plot two timeseries, you could also use the right vertical axis as well. In that case you have to substitute "2" with "4" in the functions axis() and mtext(). Notice that in both functions lines is increased so that the new axis and its label is placed to the left of the first one. You don't need to increase the value if you use the right vertical axis.


par(new=T)
plot(time, med, axes=F, ylim=c(0,max(med)), xlab="", ylab="", 
type="l",lty=2, main="",xlim=c(7000,3400),lwd=2)
axis(2, ylim=c(0,max(med)),lwd=2,line=3.5)
points(time, med,pch=20)
mtext(2,text="Median Group Size",line=5.5)

#Plot the third time series. Again the line parameter are both further increased.

par(new=T)
plot(time, grp, axes=F, ylim=c(0,max(grp)), xlab="", ylab="", 
type="l",lty=3, main="",xlim=c(7000,3400),lwd=2)
axis(2, ylim=c(0,max(grp)),lwd=2,line=7)

points(time, grp,pch=20)
mtext(2,text="Number of Groups",line=9)

#We can now draw the X-axis, which is of course shared by all the three time-series.

axis(1,pretty(range(time),10))
mtext("cal BP",side=1,col="black",line=2)
#And then plot the legend.

legend(x=7000,y=12,legend=c("Population","Median Group Size","Number of Groups"),lty=c(1,2,3))
sources: http://evolvingspaces.blogspot.com/2011/05/multiple-y-axis-in-r-plot.html

Friday, May 6, 2011

恋爱必去的古镇有哪些?

恋爱了,你是否在盘算怎么和心爱的他/她度过这个浪漫的“蜜月期”呢?送巧克力?太俗!看电影?更老套?想去旅游?可是不知道去哪!没关系,收拾好行装、跟随着我的脚步,带你一起去恋爱必去的地方旅行吧!
  
  一:丽江
  丽江——寻梦和接近天堂的地方
  都说丽江是个适合发呆的地方,这话一点也不假,在时光倒退了二十年的地方,住在一个古老的四合院里,满天都是星星,泡一壶玉龙雪山茶,什么也不想,静的只可以听的见自己的心跳。也许在你的身旁就有一个异国的MM和你一样在发着呆,你们偶尔眼睛对在一起,便会心的一笑。是啊,丽江是什么也不想却让你心跳的地方,恋爱一场也许会变的很简单。
  在中国这么大的一个地方,丽江是独一无二的,一方面你可以极小资的过着风花雪月般的烂漫日子,同时你又可以极自我安慰的说自己到了香格里拉一个传说中是天堂的地方。有多少年青人被迷惑在这里,有多少行者在这里停留,有多少艺术家在这里寻梦,有多少被城市折磨的失去自我的人在这里疗伤。带上心爱的他/她,在这里充分的享受最闲适、最放松的生活吧!
  
  二:阳朔
  阳朔——每天都有事可做
  阳朔漓江一线的山水世界一流,可是最吸引的人却在山水之外的一条街上,而且这条街上每日都人潮汹涌,如果你不深入这条街里,你会只以为它很俗气,新改造的仿古街上,一间挨着一间的就是酒吧,咖啡屋,小客栈,工艺品店,一些外国人,一些艺术家,一些攀岩者,一些每日买醉的游客。可是你如果爱着生活,如果你只是个俗人,你一定会爱上这里,这里是一个交流的地方,世界各种肤色在这里都可以看的见,世界为何只是一个村落,阳朔就是最完美的解释。
  在阳朔你每天都有事可做,在西街上你可以很容易的租到一辆自行车,到附近去走走看看,而且有很多徒步线路是做游船感爱不到的。你可以不太介意这里的天气好坏,只要有足够的心情,你便可以做个小中巴到兴坪,然后从兴坪开始一直走到阳堤,这一线是漓江的精华,而且不会耗掉你太多的体力,田院风光就在你面前,土地的芬芳浸润着你的五脏六肺,再加上一些很传统的民房与世隔绝般的呈现出世外桃源的境界。唯一让人遗憾的是,这样的徒步没有一点挑战性,不过不要紧,如果你想在阳朔很刺激的玩上两天,那么去会会那些疯狂的攀岩者们,那些响当当的攀岩高手都聚集在阳朔这条西街。
  所以、在阳朔,你和她是绝对不会无聊、不会无事可做的,这里每天都有着新奇和挑战在等着你们!
  
  三:大理
  大理——不可复制的文化气质
  大理这个地方真是一言难尽,它不足于和丽江比试风情,它不及阳朔风光的一半,你能体会到的只有二个字,自由。
  为了自由多少人可以抛开一切,甚至生命,在大理的古城你可以横躺在马路上没有人来管你,在一些小食店里你甚至可以和老板商量能不能在五元钱一份的米线里加上一块免费的大猪排;如果你能够在大理住上一个星期,你就可以神气的在古城里和人招呼着与被招呼着,俨如一个住上很多年的半个大理人了。这里的文化气质是其它地方模仿不出的,这么小的一块土地上有那么多的书吧和小型画L,而且名字也奇特,什么面条书屋,鸟吧,唐朝,一个小的可能只能容的下七八个人的地方也可做的极精致,既可以喝到最纯正的咖啡又可以欣赏到画家最前卫的作品,这便是一个名字起的狂野的叫YAK的一个地方。
  
  
  四:成都
  成都——今朝有酒今朝醉
  成都是一个多元化的城市,历史遗留下的建筑虽已所剩无几,但成都却还是有着历史文化感的一个地方。每条街上都会有两个个以上的茶馆,你会吃惊的发现这里的人可以捧着一杯盖碗茶就耗上一整天的时间,这里的年青人丝毫找不出其它大城市年青人脸上刻写着的,时间宝贵的字样。
但说来也奇怪,这里却是一个各个方面都很敏感的城市。这里有很多城市的影子,比如商业,这里的商业气息浓的比上海还要过份;成都是个很隐晦的城市,形形色色的人在这里鱼龙混杂,有的人很忙碌,有的人什么也不干却也可以活的有滋有味。
  曾经听过有人这样形容一个市井的成都人:他身上只有十块钱,他会进入一个大众茶馆要上三块钱一杯的盖碗茶,接着两块钱捣个耳朵小舒服一下,然后说不定还会脱下皮鞋用一元钱擦的锃亮,这个时候他并不知道包里还有多少,一口气可能买下无数份报纸就这样消耗掉一整天,真不知道晚上吃什么。其实这或多或少有些夸张,不过成都人就是这样的,换句话来讲,整个就是“今朝有酒今朝醉”的心态。
  
  
  五:白玉
  白玉——思想在这里一片空白
  如果白玉不能称为天堂的话,那么其它的地方真的就是百分之百的地狱了。
  白玉的光线是特别的,在黄昏的时候,白玉寺视觉冲击让人心慌意乱。而早上的白玉寺让人充满希望,仿佛自己是初生的婴儿,思想在这样的光线中是一片空白。中午的光线是烤人的,那种要把人烤化的感觉,让你甚至不想做任何的防备。
  白玉县几公里外的GADUO寺有传统的佛事活动,上千个喇叭拿着巨大的带杆的鼓,所有的喇叭都穿着非常标准的服装,一座山全是人,而所有的人都是藏区那特有的穿着和肤色。在离白玉不远的地方还有一个深埋在大山里的“最后的父系氏族”。
  所以、来到这,整个思想会进入一种空白的状态,什么都不去想,我就是整个世界!
  
  
  六:九寨沟
  九寨沟——最美的时候就在秋天
  没到九寨之前你先粗略的听听这些名字吧:原始森林,草海,天鹅海,箭竹海,熊猫海,五花海,孔雀河道,珍珠滩瀑布,静海,诺日朗群海,诺日朗瀑布。犀牛海,老虎海,树正瀑布,树正群海,卧龙海,火花海,芦苇海,盆景滩,扎如寺。则扎哇寨,下季节海,上季节海,五彩池,长海……
  你可以开始想象了吗?九寨沟会是怎么样的一个形象在你的脑海中?可是你不去的话,你根本无法想象世界上有这样的一个神奇的地方。
  九寨沟是童话的世界,不同的季节就有不同的感受。不过最美的还是秋天。
  九寨是唯美的一个地方。如果和心爱的他/她去九寨,不要怀揣太多的心事,九寨的纯净之美容不得不快乐。
  
  七:稻城
  稻城——仿佛成仙的地方
  这里很开阔,从雪山流下的水很有形状的呈几个大弯慢慢的流动着,一些很大的牦牛在湿润的草地上吃着新鲜的草,三个雪山会同时呈现在你面前,那时,有的只能是无言的震憾。
  在五千多米的海子山,云在急速的变幻,海子的颜色也在变幻,人仿佛成了神仙,心会颤动。
  生活是一环扣一环的,在稻城,会让人知道自己其实是可以忘却的。
  至于那些烦闷、你会觉得,都不算什么的。
  
  
  八:乌镇
  乌镇——中国最美的地方
  这个小家碧玉般静谧的江南小镇,没有周庄的名气,只有宁静、安详和让人感动的沧桑。白墙、青瓦、木隔扇、石板路、乌篷船、木雕、水阁、茶馆、深弄水巷,会把你带入一个如诗如画的烟雨江南......
  
  
  九:凤凰古城
  凤凰古城——风雨边城
  一座青山抱古城,一湾沱水绕城过,一条红红石板街,一排小巧吊脚楼,一道风雨古城墙,一座沧桑老城堡,一个奇绝奇梁洞,一座雄伟古石桥,一群闻名世界的人......一切,都美到极致,因此,才有了沈从文一曲《边城》,将他魂梦牵系的故土描绘得如诗如画、如梦如歌、荡气回肠。
  
  
  十:平遥古城
  平遥——历史的洪荒、古老的印记
  平遥古城是中国汉民族城市在明清时期的杰出范例,它是由完整的城墙、街道、店铺、寺庙、民居等组成的一组庞大古建筑群,是按照汉民族传统规划思想和建筑风格建设起来的城市,木制结构的镇国寺、彩塑艺术精湛的双林寺与斑驳沧桑的古城墙并称为平遥三宝。现在许多古装戏在平遥拍摄外景时,连布景都不用。想和他/她穿梭在时光的隧道里,那就去平遥吧!
  处在恋爱的幸福中,想珍存你和他的点点滴滴,那就带上心爱的他/她,一起去这些梦幻美丽的地方,渡过一次美妙的恋爱之旅,这是多么浪漫的事情。你已经心动了吧?那还等什么呢,牵着他/她的手,去旅游吧!