Professional Documents
Culture Documents
> 23+23
[1] 46
> 45-15
[1] 30
> 15*5
[1] 75
> 2*3-4+5/6
[1] 2.833333
> 2**3
[1] 8
> 2^3
[1] 8
> c(2,3,5,7)^c(2,3)
[1] 4 27 25 343
> c(2,3,5,7)^c(2,3,4)
[1] 4 27 625 49
Warning message:
In c(2, 3, 5, 7)^c(2, 3, 4) :
> C(2,3,5,7)*3
> c(2,3,5,7)+10
[1] 12 13 15 17
> c(2,3,5,7)*3
[1] 6 9 15 21
> c(2,3,5,7)+c(8,9,10)
[1] 10 12 15 15
Warning message:
> c(2,3,5,7)%/%c(2,3)
[1] 1 1 2 2
> c(2,3,5,7)%%2
[1] 0 1 1 1
> max(1.2,3.4,-7.8)
[1] 3.4
> min(c(1.2,3.5,-7.8))
[1] -7.8
> pi*2^3-sqrt(4)
[1] 23.13274
> abs(12-17*2/3-9)
[1] 8.333333
> factorial(4)
[1] 24
> log(2,10)
[1] 0.30103
> log(2)
[1] 0.6931472
> log10(2)
[1] 0.30103
> exp(0.6931472)
[1] 2
> 10^0.30103
[1] 2
> sin(45)
[1] 0.8509035
> sin(45*pi/180)
[1] 0.7071068
> asin(0.7071068)*180/pi
[1] 45
> ans1+23+14/2-18+(7*pi/2)
> ans1=23+14/2-18+(7*pi/2)
> ans1
[1] 22.99557
> ans2=13+11+(17-4/7)
> ans1+ans2
[1] 63.42415
> ans1+ans2/2
[1] 43.20986
> ans3=ans2+9-2+pi
> ans3
[1] 50.57016
> ans4-3+5
Error: object 'ans4' not found
> ans4=3+5
> ans4
[1] 8
> ans5=ans1*ans2
> ans5
[1] 929.6782
> data1
[1] 3 5 7 5 3 2 6 8 5 6 9
> data2=c(data1,4,5,7,3,4)
> data2
[1] 3 5 7 5 3 2 6 8 5 6 9 4 5 7 3 4
> day1=c("mon","tue","wed","thu")
> day1
> day1=c(day1,"fri")
> day1
> mix
[1] "3" "5" "7" "5" "3" "2" "6" "8" "5" "6" "9" "mon" "tue" "wed" "thu" "fri"
> data3=scan()
1: 6 7 8 7 6 3 8 9 10 7
11: 6 9
13:
Read 12 items
> data3
[1] 6 7 8 7 6 3 8 9 10 7 6 9
4: Thur
5:
Read 4 items
> data2
1: 23,17,12.5,11,17,12,14.5,9
9: 11,9,12,5,14.5,17,8,21
17:
Read 16 items
> data4
[1] 23.0 17.0 12.5 11.0 17.0 12.0 14.5 9.0 11.0 9.0 12.0 5.0 14.5 17.0 8.0 21.0
1: jan,feb,mar
4:
Read 3 items
> data5
1: jan,feb,mar,apr,may,jun
7: jul,aug,sep,oct,nov,dec
13:
Read 12 items
> data5
[1] "jan" "feb" "mar" "apr" "may" "jun" "jul" "aug" "sep" "oct" "nov" "dec"
> getwd()
[1] "C:/Users/HP/Documents"
[1] "C:/Users/HP/Documents"
> dir()
> list.files()
[1] "Book1.csv" "Book2.csv" "Corel User Files" "Deeksha R" "Default.rdp"
"desktop.ini"
> data7=scan(file.choose())
Error in scan(file.choose()) :
>
> data7
> data8=scan(file.choose(),what='char',sep=',')
Read 1 item
> data8
[1] "jan,feb,mar,apr,may,jun,jul,aug,"
> data8=scan(file.choose(),what='char',sep=',')
Read 1 item
> data8
[1] "jan,feb,mar,apr,may,jun,jul,aug,"
> fw
> fw=read.csv(file.choose())
> fw
ABUND FLOW
1 9 2
2 25 3
3 15 5
4 2 9
5 14 14
6 25 24
7 24 29
8 47 34
> my.ssv=read.table(file.choose(),header=TRUE)
> my.ssv
data1.data2.data3
1 1,2,4
2 4,5,3
3 3,4,5
4 3,6,6
5 4,5,9
> my.ssv
data1.data2.data3
1 1,2,4
2 4,5,3
3 3,4,5
4 3,6,6
5 4,5,9
> my.tsv=read.delim(file.choose())
> my.tsv
data1.data2.data3
1 1,2,4
2 4,5,3
3 3,4,5
4 3,6,6
5 4,5,9
> my.ssv
data1.data2.data3
1 1,2,4
2 4,5,3
3 3,4,5
4 3,6,6
5 4,5,9
> my.tsv=read.table(file.choose(),header=TRUE,sep="\t")
> my.tsv
data1.data2.data3
1 1 2 4 ,,
2 4 5 3 ,,
3 3 4 5,,
4 3 6 6,,
5 4 5 9,,
> grass=read.csv(file.choose())
> grass
mow unmow
1 12 8
2 15 9
3 17 7
4 11 9
5 15 NA
> answer1=23+17/2-pi/4
> answer1
[1] 30.7146
> ls()
[1] "ans1" "ans2" "ans3" "ans4" "ans5" "answer1" "data1" "data2" "data3" "data4" "data5"
"data8" "day1" "fw" "FW"
> ls(pattern="b")
character(0)
> ls(pattern="d")
> ls(pattern="^a"
+;
"
;"
> ls {pattern="^a")
> ls (pattern="^a")
> ls(pattern="a$")
character(0)
> ls(pattern="a.e")
character(0)
> ls(pattern="d.t")
> rm(answer1)
> rm
inherits = FALSE)
if (length(names) == 0L)
<bytecode: 0x02a0f900>
<environment: namespace:base>
> load{file="book4.csv")
> load(file="book4.csv")
Error in load(file = "book4.csv") :
bad restore file magic number (file may be corrupted) -- no data loaded
> load(file=file.choose())
bad restore file magic number (file may be corrupted) -- no data loaded
> load(file=file.choose())
bad restore file magic number (file may be corrupted) -- no data loaded
> data7=(23,17,12.5,14.5,11,12)
> data4
[1] 23.0 17.0 12.5 11.0 17.0 12.0 14.5 9.0 11.0 9.0 12.0 5.0 14.5 17.0 8.0 21.0
> data5
[1] "jan" "feb" "mar" "apr" "may" "jun" "jul" "aug" "sep" "oct" "nov" "dec"
> cut
<bytecode: 0x074501a0>
<environment: namespace:base>
> grass
mow unmow
1 12 8
2 15 9
3 17 7
4 11 9
5 15 NA
> data7
> data4
[1] 23.0 17.0 12.5 11.0 17.0 12.0 14.5 9.0 11.0 9.0 12.0 5.0 14.5 17.0 8.0 21.0
> data4i=as.integer(data4)
> data4i
[1] 23 17 12 11 17 12 14 9 11 9 12 5 14 17 8 21
> data4n=as.numeric(data4i)
> data4n
[1] 23 17 12 11 17 12 14 9 11 9 12 5 14 17 8 21
> data4c=as.character(data4(
+ data4c=as.character(data4)
+s
s"
> data4c=as.character(data4)
> data4c
[1] "23" "17" "12.5" "11" "17" "12" "14.5" "9" "11" "9" "12" "5" "14.5" "17" "8" "21"
> data5
[1] "jan" "feb" "mar" "apr" "may" "jun" "jul" "aug" "sep" "oct" "nov" "dec"
> data5n=as.numeric(data5)
Warning message:
> data5n
[1] NA NA NA NA NA NA NA NA NA NA NA NA
> data5c=as.numeric(as.factor(data5)))
> data5c=as.numeric(as.factor(data5))
> data5c
[1] 5 4 8 1 9 7 6 2 12 11 10 3
> grass.1
> str(grass)
$ mow : int 12 15 17 11 15
$ unmow: int 8 9 7 9 NA
6 song thrush NA 4 0 6 0 0
> bird=read.csv(file.choose())
> bird
X X.1 Garden Hedgeroew parkland Pasture Woodland
1 blackbird NA 47 10 40 2 2
2 chaffinch NA 19 3 5 0 2
3 Great Tit NA 50 0 10 7 0
4 House sparow NA 46 16 8 4 0
5 Robin NA 9 3 0 0 2
6 song thrush NA 4 0 6 0 0
> str(bird)
$ X.1 : logi NA NA NA NA NA NA
$ Garden : int 47 19 50 46 9 4
$ Hedgeroew: int 10 3 0 16 3 0
$ parkland : int 40 5 10 8 0 6
$ Pasture : int 2 0 7 4 0 0
$ Woodland : int 2 2 0 0 2 0
> class(grass
+ class(grassdd
"class(grass
class"
> class(grass)
[1] "data.frame"
> class(bird)
[1] "data.frame"
> history()
> savehistory(file='bird.rhistory')
> loadhistory(file="bird.csv")
> sys.getenv('R.histfile')
> save()
> save(list,file="bird")
> save(list,file="bird.csv")
In gzfile(file, "wb") :
>