Assign columns to grouping variable for use with ordihull plotting - r

I have a dataframe consisting of dissimilarity ratings for pairs of 12 nations, and what I wish to do is essentially divide the columns (the nations) into three different groups (not combining their scores).
I am performing a non-metric multidimensional scaling, so I would like to plot the dissimilarity ratings with convex hulls according to these three groups.
I know the code for making the plots, all I am missing is the grouping variable that is needed, and I cannot for the life of me figure out how to create it.
Brazil Congo Cuba Egypt France India Israel Japan China UdSSR USA Yugoslavia
1 0.00 4.83 5.28 3.44 4.72 4.50 3.83 3.50 2.39 3.06 5.39 3.17
2 4.83 0.00 4.56 5.00 4.00 4.83 3.33 3.39 4.00 3.39 2.39 3.50
3 5.28 4.56 0.00 5.17 4.11 4.00 3.61 2.94 5.50 5.44 3.17 5.11
4 3.44 5.00 5.17 0.00 4.78 5.83 4.67 3.83 4.39 4.39 3.33 4.28
5 4.72 4.00 4.11 4.78 0.00 3.44 4.00 4.22 3.67 5.06 5.94 4.72
6 4.50 4.83 4.00 5.83 3.44 0.00 4.11 4.50 4.11 4.50 4.28 4.00
7 3.83 3.33 3.61 4.67 4.00 4.11 0.00 4.83 3.00 4.17 5.94 4.44
8 3.50 3.39 2.94 3.83 4.22 4.50 4.83 0.00 4.17 4.61 6.06 4.28
9 2.39 4.00 5.50 4.39 3.67 4.11 3.00 4.17 0.00 5.72 2.56 5.06
10 3.06 3.39 5.44 4.39 5.06 4.50 4.17 4.61 5.72 0.00 5.00 6.67
11 5.39 2.39 3.17 3.33 5.94 4.28 5.94 6.06 2.56 5.00 0.00 3.56
12 3.17 3.50 5.11 4.28 4.72 4.00 4.44 4.28 5.06 6.67 3.56 0.00
This is probably a frustratingly simple command, but I am truly lost.

Related

How can I subset my list to have only the last day of the month?

DGS1MO DGS3MO DGS1 DGS2 DGS3 DGS5 DGS7 DGS10 DGS20 DGS30
2001-07-31 3.67 3.54 3.53 3.79 4.06 4.57 4.86 5.07 5.61 5.51
2001-08-01 3.65 3.53 3.56 3.83 4.09 4.62 4.90 5.11 5.63 5.53
2001-08-02 3.65 3.53 3.57 3.89 4.17 4.69 4.97 5.17 5.68 5.57
2001-08-03 3.63 3.52 3.57 3.91 4.22 4.72 4.99 5.20 5.70 5.59
2001-08-06 3.62 3.52 3.56 3.88 4.17 4.71 4.99 5.19 5.70 5.59
2001-08-07 3.63 3.52 3.56 3.90 4.19 4.72 5.00 5.20 5.71 5.60
2001-08-08 3.61 3.49 3.46 3.77 4.05 4.61 4.87 4.99 5.61 5.52
2001-08-09 3.61 3.45 3.48 3.77 4.07 4.66 4.93 5.04 5.64 5.54
2001-08-10 3.58 3.43 3.45 3.73 4.03 4.61 4.88 4.99 5.61 5.52
2001-08-13 3.57 3.45 3.43 3.70 4.00 4.57 4.86 4.97 5.60 5.52
2001-08-14 3.54 3.43 3.46 3.74 4.03 4.59 4.87 4.97 5.61 5.51
2001-08-15 3.52 3.43 3.47 3.80 4.11 4.62 4.90 5.00 5.62 5.52
2001-08-16 3.48 3.39 3.43 3.75 4.04 4.58 4.84 4.95 5.58 5.48
2001-08-17 3.46 3.36 3.39 3.67 3.95 4.49 4.75 4.84 5.51 5.43
2001-08-20 3.48 3.42 3.44 3.74 4.02 4.55 4.81 4.91 5.55 5.46
2001-08-21 3.46 3.39 3.41 3.69 3.96 4.50 4.79 4.87 5.54 5.44
2001-08-22 3.46 3.38 3.44 3.76 4.03 4.53 4.81 4.91 5.53 5.44
2001-08-23 3.49 3.40 3.46 3.72 3.99 4.52 4.79 4.89 5.50 5.41
2001-08-24 3.49 3.42 3.48 3.76 4.03 4.55 4.82 4.93 5.54 5.45
2001-08-27 3.52 3.45 3.51 3.78 4.04 4.57 4.83 4.94 5.56 5.47
2001-08-28 3.53 3.41 3.46 3.71 3.97 4.48 4.73 4.85 5.49 5.41
2001-08-29 3.48 3.42 3.44 3.67 3.92 4.43 4.67 4.78 5.44 5.36
2001-08-30 3.41 3.36 3.38 3.61 3.88 4.42 4.68 4.79 5.45 5.37
2001-08-31 3.40 3.37 3.41 3.64 3.91 4.46 4.72 4.85 5.47 5.39
2001-09-04 3.43 3.44 3.55 3.83 4.10 4.63 4.88 4.99 5.59 5.50
2001-09-05 3.49 3.41 3.47 3.79 4.07 4.61 4.86 4.97 5.57 5.48
2001-09-06 3.44 3.34 3.40 3.65 3.93 4.48 4.73 4.86 5.50 5.41
2001-09-07 3.40 3.27 3.29 3.53 3.82 4.39 4.67 4.80 5.45 5.39
2001-09-10 3.40 3.26 3.31 3.53 3.82 4.41 4.69 4.84 5.50 5.43
2001-09-13 2.73 2.74 2.81 2.99 3.32 4.03 4.41 4.64 5.41 5.39
2001-09-14 2.54 2.64 2.73 2.87 3.17 3.92 4.31 4.57 5.38 5.35
2001-09-17 2.47 2.59 2.72 2.96 3.30 3.99 4.38 4.63 5.44 5.41
2001-09-18 2.34 2.48 2.69 2.96 3.31 4.01 4.46 4.72 5.59 5.55
2001-09-19 2.00 2.19 2.49 2.81 3.18 3.90 4.41 4.69 5.59 5.56
2001-09-20 2.04 2.22 2.56 2.91 3.27 3.97 4.47 4.75 5.67 5.62
2001-09-21 2.12 2.25 2.53 2.91 3.27 3.94 4.43 4.70 5.62 5.59
2001-09-24 2.38 2.38 2.56 2.94 3.30 4.00 4.47 4.73 5.61 5.58
2001-09-25 2.58 2.40 2.51 2.88 3.25 3.97 4.45 4.72 5.60 5.58
2001-09-26 2.51 2.38 2.48 2.82 3.18 3.91 4.39 4.65 5.52 5.50
2001-09-27 2.34 2.38 2.43 2.78 3.15 3.87 4.33 4.58 5.46 5.45
2001-09-28 2.28 2.40 2.49 2.86 3.22 3.93 4.37 4.60 5.45 5.42
2001-10-01 2.26 2.37 2.47 2.82 3.18 3.90 4.33 4.55 5.39 5.38
2001-10-02 2.27 2.26 2.43 2.77 3.14 3.87 4.31 4.53 5.36 5.34
2001-10-03 2.21 2.23 2.38 2.77 3.14 3.86 4.29 4.50 5.34 5.32
2001-10-04 2.22 2.21 2.37 2.75 3.14 3.88 4.29 4.53 5.33 5.31
2001-10-05 2.21 2.19 2.33 2.71 3.10 3.87 4.26 4.52 5.34 5.31
2001-10-09 2.24 2.22 2.35 2.74 3.16 3.96 4.35 4.62 5.42 5.39
Above I have my dataset that I am trying to subset. My goals is to subset the df to only include the last day of each month listed. For example 8/31/2021,9/27/2021...etc onward through the data.
I have been able to do specific dates but I need something that is dynamic.
Thanks in advance
With lubridate:
library(lubridate)
df$DAY <- as.Date(df$DAY)
df[df$DAY == ceiling_date(df$DAY,'month') - days(1),]
DAY DGS1MO DGS3MO DGS1 DGS2 DGS3 DGS5 DGS7 DGS10 DGS20 DGS30
1 2001-07-31 3.67 3.54 3.53 3.79 4.06 4.57 4.86 5.07 5.61 5.51
24 2001-08-31 3.40 3.37 3.41 3.64 3.91 4.46 4.72 4.85 5.47 5.39
df:
df <- read.table(text='
DAY DGS1MO DGS3MO DGS1 DGS2 DGS3 DGS5 DGS7 DGS10 DGS20 DGS30
2001-07-31 3.67 3.54 3.53 3.79 4.06 4.57 4.86 5.07 5.61 5.51
2001-08-01 3.65 3.53 3.56 3.83 4.09 4.62 4.90 5.11 5.63 5.53
2001-08-02 3.65 3.53 3.57 3.89 4.17 4.69 4.97 5.17 5.68 5.57
2001-08-03 3.63 3.52 3.57 3.91 4.22 4.72 4.99 5.20 5.70 5.59
2001-08-06 3.62 3.52 3.56 3.88 4.17 4.71 4.99 5.19 5.70 5.59
2001-08-07 3.63 3.52 3.56 3.90 4.19 4.72 5.00 5.20 5.71 5.60
2001-08-08 3.61 3.49 3.46 3.77 4.05 4.61 4.87 4.99 5.61 5.52
2001-08-09 3.61 3.45 3.48 3.77 4.07 4.66 4.93 5.04 5.64 5.54
2001-08-10 3.58 3.43 3.45 3.73 4.03 4.61 4.88 4.99 5.61 5.52
2001-08-13 3.57 3.45 3.43 3.70 4.00 4.57 4.86 4.97 5.60 5.52
2001-08-14 3.54 3.43 3.46 3.74 4.03 4.59 4.87 4.97 5.61 5.51
2001-08-15 3.52 3.43 3.47 3.80 4.11 4.62 4.90 5.00 5.62 5.52
2001-08-16 3.48 3.39 3.43 3.75 4.04 4.58 4.84 4.95 5.58 5.48
2001-08-17 3.46 3.36 3.39 3.67 3.95 4.49 4.75 4.84 5.51 5.43
2001-08-20 3.48 3.42 3.44 3.74 4.02 4.55 4.81 4.91 5.55 5.46
2001-08-21 3.46 3.39 3.41 3.69 3.96 4.50 4.79 4.87 5.54 5.44
2001-08-22 3.46 3.38 3.44 3.76 4.03 4.53 4.81 4.91 5.53 5.44
2001-08-23 3.49 3.40 3.46 3.72 3.99 4.52 4.79 4.89 5.50 5.41
2001-08-24 3.49 3.42 3.48 3.76 4.03 4.55 4.82 4.93 5.54 5.45
2001-08-27 3.52 3.45 3.51 3.78 4.04 4.57 4.83 4.94 5.56 5.47
2001-08-28 3.53 3.41 3.46 3.71 3.97 4.48 4.73 4.85 5.49 5.41
2001-08-29 3.48 3.42 3.44 3.67 3.92 4.43 4.67 4.78 5.44 5.36
2001-08-30 3.41 3.36 3.38 3.61 3.88 4.42 4.68 4.79 5.45 5.37
2001-08-31 3.40 3.37 3.41 3.64 3.91 4.46 4.72 4.85 5.47 5.39
2001-09-04 3.43 3.44 3.55 3.83 4.10 4.63 4.88 4.99 5.59 5.50
2001-09-05 3.49 3.41 3.47 3.79 4.07 4.61 4.86 4.97 5.57 5.48
2001-09-06 3.44 3.34 3.40 3.65 3.93 4.48 4.73 4.86 5.50 5.41
2001-09-07 3.40 3.27 3.29 3.53 3.82 4.39 4.67 4.80 5.45 5.39
2001-09-10 3.40 3.26 3.31 3.53 3.82 4.41 4.69 4.84 5.50 5.43
2001-09-13 2.73 2.74 2.81 2.99 3.32 4.03 4.41 4.64 5.41 5.39
2001-09-14 2.54 2.64 2.73 2.87 3.17 3.92 4.31 4.57 5.38 5.35
2001-09-17 2.47 2.59 2.72 2.96 3.30 3.99 4.38 4.63 5.44 5.41
2001-09-18 2.34 2.48 2.69 2.96 3.31 4.01 4.46 4.72 5.59 5.55
2001-09-19 2.00 2.19 2.49 2.81 3.18 3.90 4.41 4.69 5.59 5.56
2001-09-20 2.04 2.22 2.56 2.91 3.27 3.97 4.47 4.75 5.67 5.62
2001-09-21 2.12 2.25 2.53 2.91 3.27 3.94 4.43 4.70 5.62 5.59
2001-09-24 2.38 2.38 2.56 2.94 3.30 4.00 4.47 4.73 5.61 5.58
2001-09-25 2.58 2.40 2.51 2.88 3.25 3.97 4.45 4.72 5.60 5.58
2001-09-26 2.51 2.38 2.48 2.82 3.18 3.91 4.39 4.65 5.52 5.50
2001-09-27 2.34 2.38 2.43 2.78 3.15 3.87 4.33 4.58 5.46 5.45
2001-09-28 2.28 2.40 2.49 2.86 3.22 3.93 4.37 4.60 5.45 5.42
2001-10-01 2.26 2.37 2.47 2.82 3.18 3.90 4.33 4.55 5.39 5.38
2001-10-02 2.27 2.26 2.43 2.77 3.14 3.87 4.31 4.53 5.36 5.34
2001-10-03 2.21 2.23 2.38 2.77 3.14 3.86 4.29 4.50 5.34 5.32
2001-10-04 2.22 2.21 2.37 2.75 3.14 3.88 4.29 4.53 5.33 5.31
2001-10-05 2.21 2.19 2.33 2.71 3.10 3.87 4.26 4.52 5.34 5.31
2001-10-09 2.24 2.22 2.35 2.74 3.16 3.96 4.35 4.62 5.42 5.39',header=T)
A possible solution:
library(tidyverse)
library(lubridate)
df %>%
mutate(d = day(ymd(Date)), m = month(ymd(Date)), y = year(ymd(Date))) %>%
group_by(m, y) %>%
slice_max(d) %>%
ungroup %>%
select(-d, -m, -y)
#> # A tibble: 4 × 11
#> Date DGS1MO DGS3MO DGS1 DGS2 DGS3 DGS5 DGS7 DGS10 DGS20 DGS30
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 2001-07-31 3.67 3.54 3.53 3.79 4.06 4.57 4.86 5.07 5.61 5.51
#> 2 2001-08-31 3.4 3.37 3.41 3.64 3.91 4.46 4.72 4.85 5.47 5.39
#> 3 2001-09-28 2.28 2.4 2.49 2.86 3.22 3.93 4.37 4.6 5.45 5.42
#> 4 2001-10-09 2.24 2.22 2.35 2.74 3.16 3.96 4.35 4.62 5.42 5.39
A date is the last of a month if and only if it is one day prior to the first of the following month. You can index the elements of a Date vector x satisfying this condition like so:
is_last_of_month <- function(x) {
x <- trunc(x)
x == as.Date(round(as.POSIXlt(x), units = "months")) - 1
}
x <- seq(as.Date("2022-02-24"), as.Date("2022-03-05"), by = 1)
x
## [1] "2022-02-24" "2022-02-25" "2022-02-26" "2022-02-27" "2022-02-28"
## [6] "2022-03-01" "2022-03-02" "2022-03-03" "2022-03-04" "2022-03-05"
is_last_of_month(x)
## [1] FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE
is_last_of_month operates on trunc(x) instead of x to defend against the possibility of fractional days, so that—for example—is_last_of_month(as.Date("2022-02-28") + u) is TRUE for all u greater than 0 but less than 1:
y <- as.Date("2022-02-28") + 0.5
y
## [1] "2022-02-28"
y == as.Date(round(as.POSIXlt(y), units = "months")) - 1
## [1] FALSE
is_last_of_month(y)
## [1] TRUE
(Well, "... for all u greater than 0 but less than 1" is not quite true in floating point arithmetic, but hopefully my meaning is clear.)

R, too much data in data.frame

I have problem with data in R. I'm loading data with:
data<-read.csv2("ceny_paliwo.csv", dec = ",")
data
an this is giving me:
X Jan Feb Mar Apr May Jun Jul Aug Sept Oct Nov Dec
1 2014 5.32 5.34 5.34 5.27 5.29 5.23 5.29 5.22 5.19 5.17 4.98 4.75
2 2015 4.46 4.47 4.62 4.58 4.65 4.71 4.66 4.49 4.30 4.28 4.36 4.21
3 2016 3.87 3.73 3.86 3.90 4.07 4.23 4.17 4.10 4.26 4.35 4.32 4.53
4 2017 4.62 4.58 4.53 4.48 4.36 4.19 4.17 4.31 4.37 4.44 4.59 4.59
after this:
data2 <- round(unname(unlist(as.data.frame(data))), digits = 2)
data2
I'm receiving:
[1] 2014.00 2015.00 2016.00 2017.00 5.32 4.46 3.87 4.62 5.34 4.47 3.73 4.58 5.34
[14] 4.62 3.86 4.53 5.27 4.58 3.90 4.48 5.29 4.65 4.07 4.36 5.23 4.71
[27] 4.23 4.19 5.29 4.66 4.17 4.17 5.22 4.49 4.10 4.31 5.19 4.30 4.26
[40] 4.37 5.17 4.28 4.35 4.44 4.98 4.36 4.32 4.59 4.75 4.21 4.53 4.59
What I'm trying to do, is to don't have 2014.00 2015.00 2016.00 2017.00 this data in the first row.
Any idea how to do it?
Select only data from the second column like here:
data2 <- round(unname(unlist(as.data.frame(data[,c(2:ncol(data))]))), digits = 2)

Retrieve information of winning unit in a self organizing map plot

I would like to figure out which is the winning unit of a node in the kohonen plot
library(kohonen)
set.seed(0)
data("wines")
wines <- scale(wines)
som_grid <- somgrid(8, 6, "hexagonal")
som_model <- som(wines, som_grid)
plot(som_model)
The plot will look like this:
And you may know in which cluster the observation will lie with
head(data.frame(cbind(wines,unit= som_model$unit.classif)))
alcohol malic.acid ash ash.alkalinity magnesium tot..phenols flavonoids non.flav..phenols proanth col..int. col..hue
1 13.20 1.78 2.14 11.2 100 2.65 2.76 0.26 1.28 4.38 1.05
2 13.16 2.36 2.67 18.6 101 2.80 3.24 0.30 2.81 5.68 1.03
3 14.37 1.95 2.50 16.8 113 3.85 3.49 0.24 2.18 7.80 0.86
4 13.24 2.59 2.87 21.0 118 2.80 2.69 0.39 1.82 4.32 1.04
5 14.20 1.76 2.45 15.2 112 3.27 3.39 0.34 1.97 6.75 1.05
6 14.39 1.87 2.45 14.6 96 2.50 2.52 0.30 1.98 5.25 1.02
OD.ratio proline unit
1 3.40 1050 24
2 3.17 1185 46
3 3.45 1480 48
4 2.93 735 4
5 2.85 1450 48
6 3.58 1290 47
But I would like to retrieve this unit information in the plot, like putting a text in the nodes with this unit number in the same way that identify function does, but automatically. Thanks in advance!

'max.print' option in R

I have a data.frame with 178 rows and 14 columns. When I print it into the R-console, it only shows me 71 rows, despite the max.print option being set to 1000 rows.
Could anyone please explain why max.print option doesn't work to print full dataset in R console? And how can I do that?
I use R 3.4.1 on MacOS.
Here is a data example:
1 1 14.23 1.71 2.43 15.6 127 2.80 3.06 0.28 2.29 5.640000 1.040 3.92 1065
2 1 13.20 1.78 2.14 11.2 100 2.65 2.76 0.26 1.28 4.380000 1.050 3.40 1050
3 1 13.16 2.36 2.67 18.6 101 2.80 3.24 0.30 2.81 5.680000 1.030 3.17 1185
4 1 14.37 1.95 2.50 16.8 113 3.85 3.49 0.24 2.18 7.800000 0.860 3.45 1480
5 1 13.24 2.59 2.87 21.0 118 2.80 2.69 0.39 1.82 4.320000 1.040 2.93 735
6 1 14.20 1.76 2.45 15.2 112 3.27 3.39 0.34 1.97 6.750000 1.050 2.85 1450
7 1 14.39 1.87 2.45 14.6 96 2.50 2.52 0.30 1.98 5.250000 1.020 3.58 1290
8 1 14.06 2.15 2.61 17.6 121 2.60 2.51 0.31 1.25 5.050000 1.060 3.58 1295
9 1 14.83 1.64 2.17 14.0 97 2.80 2.98 0.29 1.98 5.200000 1.080 2.85 1045
10 1 13.86 1.35 2.27 16.0 98 2.98 3.15 0.22 1.85 7.220000 1.010 3.55 1045
11 1 14.10 2.16 2.30 18.0 105 2.95 3.32 0.22 2.38 5.750000 1.250 3.17 1510
12 1 14.12 1.48 2.32 16.8 95 2.20 2.43 0.26 1.57 5.000000 1.170 2.82 1280
13 1 13.75 1.73 2.41 16.0 89 2.60 2.76 0.29 1.81 5.600000 1.150 2.90 1320
14 1 14.75 1.73 2.39 11.4 91 3.10 3.69 0.43 2.81 5.400000 1.250 2.73 1150
15 1 14.38 1.87 2.38 12.0 102 3.30 3.64 0.29 2.96 7.500000 1.200 3.00 1547
16 1 13.63 1.81 2.70 17.2 112 2.85 2.91 0.30 1.46 7.300000 1.280 2.88 1310
17 1 14.30 1.92 2.72 20.0 120 2.80 3.14 0.33 1.97 6.200000 1.070 2.65 1280
18 1 13.83 1.57 2.62 20.0 115 2.95 3.40 0.40 1.72 6.600000 1.130 2.57 1130
19 1 14.19 1.59 2.48 16.5 108 3.30 3.93 0.32 1.86 8.700000 1.230 2.82 1680
20 1 13.64 3.10 2.56 15.2 116 2.70 3.03 0.17 1.66 5.100000 0.960 3.36 845
21 1 14.06 1.63 2.28 16.0 126 3.00 3.17 0.24 2.10 5.650000 1.090 3.71 780
22 1 12.93 3.80 2.65 18.6 102 2.41 2.41 0.25 1.98 4.500000 1.030 3.52 770
23 1 13.71 1.86 2.36 16.6 101 2.61 2.88 0.27 1.69 3.800000 1.110 4.00 1035
24 1 12.85 1.60 2.52 17.8 95 2.48 2.37 0.26 1.46 3.930000 1.090 3.63 1015
25 1 13.50 1.81 2.61 20.0 96 2.53 2.61 0.28 1.66 3.520000 1.120 3.82 845
26 1 13.05 2.05 3.22 25.0 124 2.63 2.68 0.47 1.92 3.580000 1.130 3.20 830
27 1 13.39 1.77 2.62 16.1 93 2.85 2.94 0.34 1.45 4.800000 0.920 3.22 1195
28 1 13.30 1.72 2.14 17.0 94 2.40 2.19 0.27 1.35 3.950000 1.020 2.77 1285
29 1 13.87 1.90 2.80 19.4 107 2.95 2.97 0.37 1.76 4.500000 1.250 3.40 915
30 1 14.02 1.68 2.21 16.0 96 2.65 2.33 0.26 1.98 4.700000 1.040 3.59 1035
31 1 13.73 1.50 2.70 22.5 101 3.00 3.25 0.29 2.38 5.700000 1.190 2.71 1285
32 1 13.58 1.66 2.36 19.1 106 2.86 3.19 0.22 1.95 6.900000 1.090 2.88 1515
33 1 13.68 1.83 2.36 17.2 104 2.42 2.69 0.42 1.97 3.840000 1.230 2.87 990
34 1 13.76 1.53 2.70 19.5 132 2.95 2.74 0.50 1.35 5.400000 1.250 3.00 1235
35 1 13.51 1.80 2.65 19.0 110 2.35 2.53 0.29 1.54 4.200000 1.100 2.87 1095
36 1 13.48 1.81 2.41 20.5 100 2.70 2.98 0.26 1.86 5.100000 1.040 3.47 920
37 1 13.28 1.64 2.84 15.5 110 2.60 2.68 0.34 1.36 4.600000 1.090 2.78 880
38 1 13.05 1.65 2.55 18.0 98 2.45 2.43 0.29 1.44 4.250000 1.120 2.51 1105
39 1 13.07 1.50 2.10 15.5 98 2.40 2.64 0.28 1.37 3.700000 1.180 2.69 1020
40 1 14.22 3.99 2.51 13.2 128 3.00 3.04 0.20 2.08 5.100000 0.890 3.53 760
41 1 13.56 1.71 2.31 16.2 117 3.15 3.29 0.34 2.34 6.130000 0.950 3.38 795
42 1 13.41 3.84 2.12 18.8 90 2.45 2.68 0.27 1.48 4.280000 0.910 3.00 1035
43 1 13.88 1.89 2.59 15.0 101 3.25 3.56 0.17 1.70 5.430000 0.880 3.56 1095
44 1 13.24 3.98 2.29 17.5 103 2.64 2.63 0.32 1.66 4.360000 0.820 3.00 680
45 1 13.05 1.77 2.10 17.0 107 3.00 3.00 0.28 2.03 5.040000 0.880 3.35 885
46 1 14.21 4.04 2.44 18.9 111 2.85 2.65 0.30 1.25 5.240000 0.870 3.33 1080
47 1 14.38 3.59 2.28 16.0 102 3.25 3.17 0.27 2.19 4.900000 1.040 3.44 1065
48 1 13.90 1.68 2.12 16.0 101 3.10 3.39 0.21 2.14 6.100000 0.910 3.33 985
49 1 14.10 2.02 2.40 18.8 103 2.75 2.92 0.32 2.38 6.200000 1.070 2.75 1060
50 1 13.94 1.73 2.27 17.4 108 2.88 3.54 0.32 2.08 8.900000 1.120 3.10 1260
51 1 13.05 1.73 2.04 12.4 92 2.72 3.27 0.17 2.91 7.200000 1.120 2.91 1150
52 1 13.83 1.65 2.60 17.2 94 2.45 2.99 0.22 2.29 5.600000 1.240 3.37 1265
53 1 13.82 1.75 2.42 14.0 111 3.88 3.74 0.32 1.87 7.050000 1.010 3.26 1190
54 1 13.77 1.90 2.68 17.1 115 3.00 2.79 0.39 1.68 6.300000 1.130 2.93 1375
55 1 13.74 1.67 2.25 16.4 118 2.60 2.90 0.21 1.62 5.850000 0.920 3.20 1060
56 1 13.56 1.73 2.46 20.5 116 2.96 2.78 0.20 2.45 6.250000 0.980 3.03 1120
57 1 14.22 1.70 2.30 16.3 118 3.20 3.00 0.26 2.03 6.380000 0.940 3.31 970
58 1 13.29 1.97 2.68 16.8 102 3.00 3.23 0.31 1.66 6.000000 1.070 2.84 1270
59 1 13.72 1.43 2.50 16.7 108 3.40 3.67 0.19 2.04 6.800000 0.890 2.87 1285
60 2 12.37 0.94 1.36 10.6 88 1.98 0.57 0.28 0.42 1.950000 1.050 1.82 520
61 2 12.33 1.10 2.28 16.0 101 2.05 1.09 0.63 0.41 3.270000 1.250 1.67 680
62 2 12.64 1.36 2.02 16.8 100 2.02 1.41 0.53 0.62 5.750000 0.980 1.59 450
63 2 13.67 1.25 1.92 18.0 94 2.10 1.79 0.32 0.73 3.800000 1.230 2.46 630
64 2 12.37 1.13 2.16 19.0 87 3.50 3.10 0.19 1.87 4.450000 1.220 2.87 420
65 2 12.17 1.45 2.53 19.0 104 1.89 1.75 0.45 1.03 2.950000 1.450 2.23 355
66 2 12.37 1.21 2.56 18.1 98 2.42 2.65 0.37 2.08 4.600000 1.190 2.30 678
67 2 13.11 1.01 1.70 15.0 78 2.98 3.18 0.26 2.28 5.300000 1.120 3.18 502
68 2 12.37 1.17 1.92 19.6 78 2.11 2.00 0.27 1.04 4.680000 1.120 3.48 510
69 2 13.34 0.94 2.36 17.0 110 2.53 1.30 0.55 0.42 3.170000 1.020 1.93 750
70 2 12.21 1.19 1.75 16.8 151 1.85 1.28 0.14 2.50 2.850000 1.280 3.07 718
71 2 12.29 1.61 2.21 20.4 103 1.10 1.02 0.37 1.46 3.050000 0.906 1.82 870
[ reached getOption("max.print") -- omitted 107 rows ]```
options(max.print = 99999)
try this command
Type this code at the start of your R code. Worked for me:
options(max.print = .Machine$integer.max)

Plot multiple tables in a single plot

I have 11 time series which include a temperature column. In other words there are 11 tables which should be presented in a single plot with different lines in color or line type.
t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11
4.14 4.12 4.09 4.07 4.14 4.14 4.12 4.09 4.07 5.70 42.67
4.01 3.99 3.97 3.94 4.01 4.01 3.99 3.97 3.94 4.14 39.98
3.89 3.86 3.84 3.82 3.89 3.89 3.86 3.84 3.82 4.01 38.73
3.77 3.74 3.72 3.69 3.77 3.77 3.74 3.72 3.69 3.89 37.50
3.64 3.62 3.59 3.57 3.64 3.64 3.62 3.59 3.57 3.77 36.25
3.52 3.50 3.48 3.45 3.52 3.52 3.50 3.48 3.45 3.64 35.07
3.40 3.38 3.35 3.33 3.40 3.40 3.38 3.35 3.33 3.52 33.86
3.27 3.24 3.22 3.19 3.27 3.27 3.24 3.22 3.19 3.40 32.52
3.13 3.10 3.07 3.05 3.13 3.13 3.10 3.07 3.05 3.27 31.11
2.99 2.96 2.94 2.91 2.99 2.99 2.96 2.94 2.91 3.13 29.73
2.85 2.81 2.78 2.75 2.85 2.85 2.81 2.78 2.75 2.99 28.23
2.69 2.66 2.63 2.59 2.69 2.69 2.66 2.63 2.59 2.85 26.69
2.53 2.49 2.46 2.42 2.53 2.53 2.49 2.46 2.42 2.69 25.01
2.36 2.33 2.29 2.26 2.36 2.36 2.33 2.29 2.26 2.53 23.36
2.19 2.16 2.13 2.10 2.19 2.19 2.16 2.13 2.10 2.36 21.74
2.05 2.02 1.98 1.95 2.05 2.05 2.02 1.98 1.95 2.19 20.24
One option is :
use melt to reshape data
ggplot2 to plot the melten data
dat$date <- seq(as.Date('2011-01-01'),as.Date('2011-01-31'),
length.out=dim(dat)[1])
library(reshape2)
dat.m <- melt(dat,id='date')
library(ggplot2)
qplot(data=subset(dat.m),x= date, y=value,color=variable, geom='line')
I remove the t11 variable from dataset and replot
qplot(data=subset(dat.m, variable != 't11'),x= date, y=value,
color=variable, geom='line')

Resources