Reformat data frame into a single row - r

I want to format my data frame into a single row.
So I have this
RT 200 201 202 203 204 205
2 2.5 3.5 4.5 5.5 6.5 7.5
3 2.6 3.6 4.6 5.6 6.6 7.6
4 2.7 3.7 4.7 5.7 6.7 7.7
And I want this:
m/z 200 201 202 203 204 205 200 201 202 203 204 205 200 201 202 203 204 205
RT 2 2 2 2 2 2 3 3 3 3 3 3 4 4 4 4 4 4
Sa 2.5 3.5 4.5 5.5 6.5 7.5 2.6 3.6 4.6 5.6 6.6 7.6 2.7 3.7 4.7 5.7 6.7 7.7
Can anyone provide me code for this?
Note: I want to add row names "m/z" and "Sa" to the rows instead of leaving it blank.

Related

Setting defaults by ggproto when extending ggplot2

I ran the R Code posted in http://ggplot2.tidyverse.org/articles/extending-ggplot2.html#picking-defaults
and the following is the modified code that added some print() to show the values of variables in each step, my questions are marked as comments in the code:
StatDensityCommon <- ggproto("StatDensityCommon", Stat, required_aes = "x",
setup_params = function(data, params) {
print("PARAMS BEFORE:")
print(params)
if(!is.null(params$bandwidth))
return(params)
print("DATA: ")
print(data)
#1. When and how does the data being modified and the "group" field added?
xs <- split(data$x, data$group)
print("XS: ")
print(xs)
bws <- vapply(xs, bw.nrd0, numeric(1))
print("BWS: ")
print(bws)
bw <- mean(bws)
print("BW: ")
print(bw)
message("Picking bandwidth of ", signif(bw, 3))
params$bandwidth <- bw
print("PARAMS AFTER: ")
print(params)
params
},
compute_group = function(data, scales, bandwidth = 1) {
#2. how does the bandwidth computed in setup_params passed into compute_group
#even if the bandwidth has already been set to 1 in the arguments?
d <- density(data$x, bw = bandwidth)
data.frame(x = d$x, y = d$y)
}
)
stat_density_common <- function(mapping = NULL, data = NULL, geom = "line", position = "identity", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, bandwidth = NULL, ...){
layer(stat = StatDensityCommon, data = data, mapping = mapping, geom = geom, position = position, show.legend = show.legend, inherit.aes = inherit.aes, params = list(bandwidth = bandwidth, na.rm = na.rm, ...))
}
ggplot(mpg, aes(displ, colour = drv)) + stat_density_common()
The following are the outputs except the plot:
[1] "PARAMS BEFORE:"
$bandwidth
NULL
$na.rm
[1] FALSE
[1] "DATA: "
x colour PANEL group
1 1.8 f 1 2
2 1.8 f 1 2
3 2.0 f 1 2
4 2.0 f 1 2
5 2.8 f 1 2
6 2.8 f 1 2
7 3.1 f 1 2
8 1.8 4 1 1
9 1.8 4 1 1
10 2.0 4 1 1
11 2.0 4 1 1
12 2.8 4 1 1
13 2.8 4 1 1
14 3.1 4 1 1
15 3.1 4 1 1
16 2.8 4 1 1
17 3.1 4 1 1
18 4.2 4 1 1
19 5.3 r 1 3
20 5.3 r 1 3
21 5.3 r 1 3
22 5.7 r 1 3
23 6.0 r 1 3
24 5.7 r 1 3
25 5.7 r 1 3
26 6.2 r 1 3
27 6.2 r 1 3
28 7.0 r 1 3
29 5.3 4 1 1
30 5.3 4 1 1
31 5.7 4 1 1
32 6.5 4 1 1
33 2.4 f 1 2
34 2.4 f 1 2
35 3.1 f 1 2
36 3.5 f 1 2
37 3.6 f 1 2
38 2.4 f 1 2
39 3.0 f 1 2
40 3.3 f 1 2
41 3.3 f 1 2
42 3.3 f 1 2
43 3.3 f 1 2
44 3.3 f 1 2
45 3.8 f 1 2
46 3.8 f 1 2
47 3.8 f 1 2
48 4.0 f 1 2
49 3.7 4 1 1
50 3.7 4 1 1
51 3.9 4 1 1
52 3.9 4 1 1
53 4.7 4 1 1
54 4.7 4 1 1
55 4.7 4 1 1
56 5.2 4 1 1
57 5.2 4 1 1
58 3.9 4 1 1
59 4.7 4 1 1
60 4.7 4 1 1
61 4.7 4 1 1
62 5.2 4 1 1
63 5.7 4 1 1
64 5.9 4 1 1
65 4.7 4 1 1
66 4.7 4 1 1
67 4.7 4 1 1
68 4.7 4 1 1
69 4.7 4 1 1
70 4.7 4 1 1
71 5.2 4 1 1
72 5.2 4 1 1
73 5.7 4 1 1
74 5.9 4 1 1
75 4.6 r 1 3
76 5.4 r 1 3
77 5.4 r 1 3
78 4.0 4 1 1
79 4.0 4 1 1
80 4.0 4 1 1
81 4.0 4 1 1
82 4.6 4 1 1
83 5.0 4 1 1
84 4.2 4 1 1
85 4.2 4 1 1
86 4.6 4 1 1
87 4.6 4 1 1
88 4.6 4 1 1
89 5.4 4 1 1
90 5.4 4 1 1
91 3.8 r 1 3
92 3.8 r 1 3
93 4.0 r 1 3
94 4.0 r 1 3
95 4.6 r 1 3
96 4.6 r 1 3
97 4.6 r 1 3
98 4.6 r 1 3
99 5.4 r 1 3
100 1.6 f 1 2
101 1.6 f 1 2
102 1.6 f 1 2
103 1.6 f 1 2
104 1.6 f 1 2
105 1.8 f 1 2
106 1.8 f 1 2
107 1.8 f 1 2
108 2.0 f 1 2
109 2.4 f 1 2
110 2.4 f 1 2
111 2.4 f 1 2
112 2.4 f 1 2
113 2.5 f 1 2
114 2.5 f 1 2
115 3.3 f 1 2
116 2.0 f 1 2
117 2.0 f 1 2
118 2.0 f 1 2
119 2.0 f 1 2
120 2.7 f 1 2
121 2.7 f 1 2
122 2.7 f 1 2
123 3.0 4 1 1
124 3.7 4 1 1
125 4.0 4 1 1
126 4.7 4 1 1
127 4.7 4 1 1
128 4.7 4 1 1
129 5.7 4 1 1
130 6.1 4 1 1
131 4.0 4 1 1
132 4.2 4 1 1
133 4.4 4 1 1
134 4.6 4 1 1
135 5.4 r 1 3
136 5.4 r 1 3
137 5.4 r 1 3
138 4.0 4 1 1
139 4.0 4 1 1
140 4.6 4 1 1
141 5.0 4 1 1
142 2.4 f 1 2
143 2.4 f 1 2
144 2.5 f 1 2
145 2.5 f 1 2
146 3.5 f 1 2
147 3.5 f 1 2
148 3.0 f 1 2
149 3.0 f 1 2
150 3.5 f 1 2
151 3.3 4 1 1
152 3.3 4 1 1
153 4.0 4 1 1
154 5.6 4 1 1
155 3.1 f 1 2
156 3.8 f 1 2
157 3.8 f 1 2
158 3.8 f 1 2
159 5.3 f 1 2
160 2.5 4 1 1
161 2.5 4 1 1
162 2.5 4 1 1
163 2.5 4 1 1
164 2.5 4 1 1
165 2.5 4 1 1
166 2.2 4 1 1
167 2.2 4 1 1
168 2.5 4 1 1
169 2.5 4 1 1
170 2.5 4 1 1
171 2.5 4 1 1
172 2.5 4 1 1
173 2.5 4 1 1
174 2.7 4 1 1
175 2.7 4 1 1
176 3.4 4 1 1
177 3.4 4 1 1
178 4.0 4 1 1
179 4.7 4 1 1
180 2.2 f 1 2
181 2.2 f 1 2
182 2.4 f 1 2
183 2.4 f 1 2
184 3.0 f 1 2
185 3.0 f 1 2
186 3.5 f 1 2
187 2.2 f 1 2
188 2.2 f 1 2
189 2.4 f 1 2
190 2.4 f 1 2
191 3.0 f 1 2
192 3.0 f 1 2
193 3.3 f 1 2
194 1.8 f 1 2
195 1.8 f 1 2
196 1.8 f 1 2
197 1.8 f 1 2
198 1.8 f 1 2
199 4.7 4 1 1
200 5.7 4 1 1
201 2.7 4 1 1
202 2.7 4 1 1
203 2.7 4 1 1
204 3.4 4 1 1
205 3.4 4 1 1
206 4.0 4 1 1
207 4.0 4 1 1
208 2.0 f 1 2
209 2.0 f 1 2
210 2.0 f 1 2
211 2.0 f 1 2
212 2.8 f 1 2
213 1.9 f 1 2
214 2.0 f 1 2
215 2.0 f 1 2
216 2.0 f 1 2
217 2.0 f 1 2
218 2.5 f 1 2
219 2.5 f 1 2
220 2.8 f 1 2
221 2.8 f 1 2
222 1.9 f 1 2
223 1.9 f 1 2
224 2.0 f 1 2
225 2.0 f 1 2
226 2.5 f 1 2
227 2.5 f 1 2
228 1.8 f 1 2
229 1.8 f 1 2
230 2.0 f 1 2
231 2.0 f 1 2
232 2.8 f 1 2
233 2.8 f 1 2
234 3.6 f 1 2
[1] "XS: "
$`1`
[1] 1.8 1.8 2.0 2.0 2.8 2.8 3.1 3.1 2.8 3.1 4.2 5.3 5.3 5.7 6.5 3.7 3.7 3.9 3.9 4.7 4.7 4.7 5.2 5.2
[25] 3.9 4.7 4.7 4.7 5.2 5.7 5.9 4.7 4.7 4.7 4.7 4.7 4.7 5.2 5.2 5.7 5.9 4.0 4.0 4.0 4.0 4.6 5.0 4.2
[49] 4.2 4.6 4.6 4.6 5.4 5.4 3.0 3.7 4.0 4.7 4.7 4.7 5.7 6.1 4.0 4.2 4.4 4.6 4.0 4.0 4.6 5.0 3.3 3.3
[73] 4.0 5.6 2.5 2.5 2.5 2.5 2.5 2.5 2.2 2.2 2.5 2.5 2.5 2.5 2.5 2.5 2.7 2.7 3.4 3.4 4.0 4.7 4.7 5.7
[97] 2.7 2.7 2.7 3.4 3.4 4.0 4.0
$`2`
[1] 1.8 1.8 2.0 2.0 2.8 2.8 3.1 2.4 2.4 3.1 3.5 3.6 2.4 3.0 3.3 3.3 3.3 3.3 3.3 3.8 3.8 3.8 4.0 1.6
[25] 1.6 1.6 1.6 1.6 1.8 1.8 1.8 2.0 2.4 2.4 2.4 2.4 2.5 2.5 3.3 2.0 2.0 2.0 2.0 2.7 2.7 2.7 2.4 2.4
[49] 2.5 2.5 3.5 3.5 3.0 3.0 3.5 3.1 3.8 3.8 3.8 5.3 2.2 2.2 2.4 2.4 3.0 3.0 3.5 2.2 2.2 2.4 2.4 3.0
[73] 3.0 3.3 1.8 1.8 1.8 1.8 1.8 2.0 2.0 2.0 2.0 2.8 1.9 2.0 2.0 2.0 2.0 2.5 2.5 2.8 2.8 1.9 1.9 2.0
[97] 2.0 2.5 2.5 1.8 1.8 2.0 2.0 2.8 2.8 3.6
$`3`
[1] 5.3 5.3 5.3 5.7 6.0 5.7 5.7 6.2 6.2 7.0 4.6 5.4 5.4 3.8 3.8 4.0 4.0 4.6 4.6 4.6 4.6 5.4 5.4 5.4
[25] 5.4
[1] "BWS: "
1 2 3
0.4056219 0.2482564 0.3797632
[1] "BW: "
[1] 0.3445472
Picking bandwidth of 0.345
[1] "PARAMS AFTER: "
$bandwidth
[1] 0.3445472
$na.rm
[1] FALSE
Thanks in advance!

plot() in R doesn't give scatter plot

I was expecting points but got this when I did
plot(data$v3,data$v2)
my data
V2 V3
2 -2.0 2.7
3 0.5 3.9
4 1.3 4.5
5 5.7 6.0
6 10.4 8.7
7 3.4 2.7
8 7.6 3.2
9 4.1 5.6
10 5.0 9.2
11 8.5 11.7
12 12.3 6.8
13 16.1 13.0
14 13.2 11.9
15 8.8 8.6
16 7.9 6.1
17 1.1 4.9
18 3.0 1.0
19 4.5 7.2
20 2.7 2.7
21 7.6 7.6
I tried searching but from my understanding the function is supposed to give points, not bars. How do I fix this?

R: add column with slope coefficient for values over time

I have a dataframe which has values over time. The colnames reflect the time in milliseconds. I would like to add an additional column with the slope coefficient of a line of best fit for each token.
Token 0ms 20ms 40ms 60ms 80ms
1 2.5 3.7 4.8 5.2 6.3
2 3.6 4.9 5.2 6.1 7.8
3 1.1 3.2 4.6 7.8 9.1
4 4.5 3.3 2.1 1.9 NA
5 2.1 3.5 3.7 NA NA
Some rows have NAs, as not all tokens are active for the same amount of time.
d <- read.table(text=
"Token 0ms 20ms 40ms 60ms 80ms
1 2.5 3.7 4.8 5.2 6.3
2 3.6 4.9 5.2 6.1 7.8
3 1.1 3.2 4.6 7.8 9.1
4 4.5 3.3 2.1 1.9 NA
5 2.1 3.5 3.7 NA NA",
header=TRUE,check.names=FALSE)
slopes <- apply(as.matrix(d[,-1]),1,
function(y) {
fit <- lm(y~t,
data=data.frame(y,
t=seq(0,length=length(y),by=20)))
coef(fit)[2]
})
data.frame(d,slopes,check.names=FALSE)
## Token 0ms 20ms 40ms 60ms 80ms slopes
## 1 1 2.5 3.7 4.8 5.2 6.3 0.0455
## 2 2 3.6 4.9 5.2 6.1 7.8 0.0480
## 3 3 1.1 3.2 4.6 7.8 9.1 0.1030
## 4 4 4.5 3.3 2.1 1.9 NA -0.0450
## 5 5 2.1 3.5 3.7 NA NA 0.0400

How to Separate Data Column in R

I have data structured 4464 in rows, and 1 column.
Data should be in 4464 in rows and 8 columns.
Data contains:
Each file has a two
line header, followed by data.The columns are: julian day, ten minute
interval marker, temperature, pressure, wind speed, and wind direction. The
ten minute interval marker is a number between 1 and 144 representing time.
data comes from here
There are total of 12 data files like this, and my goal is put them in one 3D array.
But I am stuck to fix this data form.
Example of Data
Jan 13 Station : 8900 Harry
Lat : 83.00S Long : 121.40W Elev : 957 M
1 1 -7.8 879.0 5.6 360.0 444.0 9.1
1 2 -7.9 879.1 4.6 360.0 444.0 9.1
1 3 -7.6 879.2 4.1 345.0 444.0 9.1
1 4 -7.6 879.3 4.1 339.0 444.0 9.1
1 5 -7.6 879.4 4.8 340.0 444.0 9.1
1 6 -7.9 879.4 3.6 340.0 444.0 9.1
1 7 -8.0 879.3 4.6 340.0 444.0 9.1
1 8 -8.0 879.4 4.1 340.0 444.0 9.1
1 9 -8.2 879.4 5.8 338.0 444.0 9.1
1 10 -8.4 879.5 4.6 339.0 444.0 9.1
I tried and researched few things, but I don't know what the best way is.
My code was (Could not code with data.frame...):
setwd("/Users/Gizmo/Documents/Henry")
dir()
h13<-dir()
henry<-read.csv(h13[1],skip=2,header=FALSE)
colnames(c("J-Day","MinInter","Temp","Pressure","WindSpeed","WindDir","Ext1","Ext2"))
I looked at other questions, and guide and data.frame seems like the best way, but I could not code. (Ended up with data dimension NULL.)
Please give me advice on this. Thank you.
Your problem seems to be using read.csv instead of read.table:
henry <- read.table(text='Jan 13 Station : 8900 Harry
Lat : 83.00S Long : 121.40W Elev : 957 M
1 1 -7.8 879.0 5.6 360.0 444.0 9.1
1 2 -7.9 879.1 4.6 360.0 444.0 9.1
1 3 -7.6 879.2 4.1 345.0 444.0 9.1
1 4 -7.6 879.3 4.1 339.0 444.0 9.1
1 5 -7.6 879.4 4.8 340.0 444.0 9.1
1 6 -7.9 879.4 3.6 340.0 444.0 9.1
1 7 -8.0 879.3 4.6 340.0 444.0 9.1
1 8 -8.0 879.4 4.1 340.0 444.0 9.1
1 9 -8.2 879.4 5.8 338.0 444.0 9.1
1 10 -8.4 879.5 4.6 339.0 444.0 9.1', header=FALSE, skip=2)
names(henry) <- c("J-Day","MinInter","Temp","Pressure","WindSpeed","WindDir","Ext1","Ext2")
Result:
> henry
J-Day MinInter Temp Pressure WindSpeed WindDir Ext1 Ext2
1 1 1 -7.8 879.0 5.6 360 444 9.1
2 1 2 -7.9 879.1 4.6 360 444 9.1
3 1 3 -7.6 879.2 4.1 345 444 9.1
4 1 4 -7.6 879.3 4.1 339 444 9.1
5 1 5 -7.6 879.4 4.8 340 444 9.1
6 1 6 -7.9 879.4 3.6 340 444 9.1
7 1 7 -8.0 879.3 4.6 340 444 9.1
8 1 8 -8.0 879.4 4.1 340 444 9.1
9 1 9 -8.2 879.4 5.8 338 444 9.1
10 1 10 -8.4 879.5 4.6 339 444 9.1
> str(henry)
'data.frame': 10 obs. of 8 variables:
$ J-Day : int 1 1 1 1 1 1 1 1 1 1
$ MinInter : int 1 2 3 4 5 6 7 8 9 10
$ Temp : num -7.8 -7.9 -7.6 -7.6 -7.6 -7.9 -8 -8 -8.2 -8.4
$ Pressure : num 879 879 879 879 879 ...
$ WindSpeed: num 5.6 4.6 4.1 4.1 4.8 3.6 4.6 4.1 5.8 4.6
$ WindDir : num 360 360 345 339 340 340 340 340 338 339
$ Ext1 : num 444 444 444 444 444 444 444 444 444 444
$ Ext2 : num 9.1 9.1 9.1 9.1 9.1 9.1 9.1 9.1 9.1 9.1

when applying the BMA packages in R : Error in terms.formula(formula, special, data = data) : '.' in formula and no 'data' argument

I am using the BMA packages in R (test.bic.surv) to estimating the Cox proportional model from a large set of variables (100 base variables and about 60 lags for each of them). When I try the first set of testing with the following codes, it works.
x1<- x[,c( "comprisk", "compriskL1", "compriskL2", "compriskL3", "compriskL4", "econrisk", "econrisk_1", "econrisk_2", "econrisk_3", "econrisk_4", "econrisk_5", "finrisk", "finrisk_1", "finrisk_2", "finrisk_3", "finrisk_4", "finrisk_5", "polrisk", "polrisk_1","polrisk_2","polrisk_3","polrisk_4","polrisk_5","polrisk_6","polrisk_7","polrisk_8","polrisk_9","polrisk_10","polrisk_11","polrisk_12")]
surv.t<- x$crisis1
cens<- x$cen1
test.bic.surv<- bic.surv(x1, surv.t, cens, factor.type=FALSE, strict=FALSE, nbest=2000)
However, whenever I tried to add in any more independent variables into x1 such as "comprisk5L" or "econriskL1", the
test.bic.surv<- bic.surv(x1, surv.t, cens, factor.type=FALSE, strict=FALSE, nbest=2000)
showed me the error like this :
"Error in terms.formula(formula, special, data = data) : '.' in formula and no 'data' argument".
I have searched through the web for several days but couldn't figure out where was the problem . Can anyone please tell me what to do?? Thank you so much in advance!!!:)
Here is what the sample data looks like:
crisis1 cen1 comprisk econrisk econrisk_1 econrisk_2 econrisk_3 econrisk_4
1 0 1 57.0 25.5 3.3 6.7 4.0 6.7
2 0 1 57.0 25.5 3.3 6.7 4.0 6.7
3 0 1 57.0 25.5 3.3 6.7 4.0 6.7
4 0 1 58.5 26.5 3.8 7.5 4.0 7.5
5 0 1 58.5 27.0 3.8 7.5 4.0 7.5
6 0 1 58.5 26.0 3.8 7.5 4.0 7.5
7 0 1 59.0 26.5 3.8 7.5 4.0 7.5
8 0 1 59.0 26.5 3.8 7.5 4.0 7.5
9 0 1 59.0 27.0 3.8 7.5 4.0 7.5
10 0 1 59.0 26.5 3.8 7.5 4.0 7.5
11 0 1 59.0 26.5 3.8 7.5 4.0 7.5
12 0 1 59.0 27.0 3.8 7.5 4.0 7.5
13 0 1 59.0 27.0 3.8 7.5 4.0 7.5
14 0 1 57.5 27.0 3.8 7.5 4.0 7.5
15 0 1 57.5 27.5 3.8 7.5 4.0 7.5
16 0 1 57.0 27.5 3.3 6.7 4.0 6.7
17 0 1 57.0 27.5 3.3 6.7 4.0 6.7
18 0 1 57.0 27.5 3.3 6.7 4.0 6.7
19 0 1 56.0 27.0 3.3 6.7 4.0 6.7
20 0 1 56.5 28.5 2.9 5.8 4.0 5.8
21 0 1 55.5 26.5 2.9 5.8 4.0 5.8
22 0 1 55.0 26.0 2.9 5.8 4.0 5.8
23 0 1 55.0 26.0 2.9 5.8 4.0 5.8
24 0 1 55.0 26.0 2.9 5.8 4.0 5.8
25 0 1 55.0 26.0 2.9 5.8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
94 0 1 52.0 27.0 2.5 5.0 3.5 5.0
95 0 1 52.0 27.0 2.5 5.0 3.5 5.0
96 0 1 52.0 28.0 2.5 5.0 3.5 5.0
97 0 1 52.5 28.5 2.5 5.0 3.5 5.0
98 0 1 54.0 28.5 2.5 5.0 3.5 5.0
99 0 1 54.0 29.0 2.5 5.0 4.0 5.0
100 0 1 53.0 28.0 2.5 5.0 4.0 5.0
101 0 1 52.5 28.0 2.1 4.2 3.5 4.2
102 0 1 52.5 28.0 2.1 4.2 3.5 4.2
103 0 1 53.0 28.0 2.1 4.2 3.5 4.2
104 0 1 53.0 28.0 2.1 4.2 3.5 4.2
105 0 1 52.5 26.0 2.1 4.2 4.0 4.2
106 0 1 54.0 26.5 2.1 4.2 4.0 4.2
107 0 1 53.5 26.5 2.1 4.2 4.0 4.2
108 0 1 53.5 26.5 2.1 4.2 4.0 4.2
109 1 1 56.0 29.5 2.1 4.2 5.0 4.2
110 1 1 53.5 27.0 2.1 4.2 4.0 4.2
111 1 1 53.5 27.0 2.1 4.2 4.0 4.2
112 1 1 53.5 26.5 2.1 4.2 5.0 4.2
113 1 1 54.0 26.5 2.1 4.2 5.0 4.2
114 1 1 52.5 24.0 2.1 4.2 4.0 4.2
115 1 1 53.0 24.5 2.1 4.2 5.0 4.2
116 1 1 54.0 26.0 2.1 4.2 4.0 4.2
117 1 1 54.0 26.0 2.1 4.2 4.0 4.2
118 1 1 54.5 26.0 2.1 4.2 4.0 4.2
119 1 1 52.5 24.5 2.1 4.2 3.5 4.2
120 1 1 52.5 24.5 2.1 4.2 3.5 4.2
121 1 1 54.0 27.5 2.1 4.2 4.0 4.2
122 1 1 54.0 27.5 2.1 4.2 4.0 4.2
123 1 1 53.0 28.5 2.1 4.2 4.0 4.2
124 1 1 53.0 28.5 2.1 4.2 4.0 4.2
125 1 1 52.5 28.0 2.1 4.2 4.0 4.2
126 1 1 52.5 27.5 2.1 4.2 4.0 4.2
127 1 1 53.0 28.0 2.1 4.2 4.5 4.2
128 1 1 53.5 28.0 2.5 5.0 4.5 5.0
129 1 1 54.5 28.0 2.5 5.0 4.5 5.0
130 1 1 54.0 26.5 2.5 5.0 3.5 5.0
131 1 1 53.5 26.0 2.5 5.0 3.5 5.0
132 1 1 54.5 26.5 2.5 5.0 3.5 5.0
133 0 1 55.5 28.0 2.5 5.0 3.5 5.0
134 0 1 56.0 28.0 2.5 5.0 3.5 5.0
135 0 1 56.0 28.0 2.5 5.0 3.5 5.0
136 0 1 54.5 27.5 2.5 5.8 3.5 5.8
137 0 1 56.0 24.5 2.9 5.8 5.0 5.8
138 0 1 58.5 29.0 2.9 5.8 5.0 5.8
139 0 1 57.5 28.5 2.9 5.8 5.0 5.8
140 0 1 57.0 28.5 2.9 5.8 5.0 5.8
141 0 1 57.0 28.5 2.9 5.8 5.0 5.8
142 0 1 58.0 28.5 2.9 5.8 5.0 5.8
143 0 1 58.0 29.5 2.9 5.8 5.0 5.8
144 0 1 59.0 29.5 2.9 5.8 5.0 5.8
145 0 1 59.0 31.0 2.9 5.8 5.5 5.8
146 0 1 59.0 31.0 2.9 5.8 5.5 5.8
147 0 1 58.5 31.0 2.9 5.8 5.5 5.8
148 0 1 58.5 31.0 2.9 5.8 5.5 5.8
149 0 1 58.5 32.0 2.5 5.0 5.5 5.0
150 0 1 58.0 32.0 2.5 5.0 5.5 5.0
151 0 1 56.8 32.5 2.5 5.0 5.5 5.0
152 0 1 58.3 31.5 3.8 7.5 5.5 7.5
153 0 1 59.0 37.0 0.5 8.5 5.5 9.5
154 0 1 59.2 37.5 1.0 8.5 5.5 9.5
155 0 1 61.0 39.5 0.5 9.0 8.0 9.0
156 0 1 60.5 39.5 0.5 9.0 8.0 9.0
157 0 1 60.0 39.5 0.5 9.0 8.0 9.0
158 0 1 59.2 39.0 0.5 8.5 8.0 9.0
159 0 1 59.5 39.5 0.5 8.5 8.5 9.0
160 0 1 59.5 39.5 0.5 8.5 8.5 9.0
161 0 1 59.5 39.5 0.5 8.5 8.5 9.0
162 0 1 59.2 39.0 0.5 8.0 8.5 9.0
163 0 1 58.7 39.0 0.5 8.0 8.5 9.0
164 0 1 58.5 38.5 0.5 7.5 8.5 9.0
165 0 1 58.0 35.0 1.0 4.0 8.5 8.0
166 0 1 57.0 35.0 1.0 4.0 8.5 8.0
167 0 1 56.2 33.5 0.5 4.0 7.5 8.0
168 0 1 56.5 34.0 1.0 4.0 7.5 8.0
169 0 1 54.7 33.5 1.0 8.5 7.5 6.0
170 0 1 52.7 30.5 1.0 6.0 7.5 6.0
171 0 1 52.7 30.5 1.0 6.0 7.5 6.0
172 0 1 54.0 33.0 1.0 8.5 7.5 6.0
173 0 1 52.1 32.7 0.2 8.5 8.0 6.0
174 0 1 50.8 32.2 0.2 8.0 8.0 6.0
175 0 1 52.1 32.2 0.2 8.0 8.0 6.0
176 0 1 51.9 32.2 0.2 8.0 8.0 6.0
177 0 1 51.7 31.5 1.0 7.0 7.5 6.0
178 0 1 51.5 31.5 1.0 7.0 7.5 6.0
179 0 1 52.7 31.5 1.0 7.0 7.5 6.0
180 0 1 52.5 31.5 1.0 7.0 7.5 6.0
181 0 1 54.5 33.5 1.0 8.5 8.5 3.5
182 0 1 55.5 33.5 1.0 8.5 8.5 3.5
183 0 1 56.7 35.0 1.0 9.0 8.5 3.5
184 0 1 56.2 35.0 1.0 9.0 8.5 3.5
185 0 1 55.5 35.0 1.0 9.0 8.5 3.5
186 0 1 56.2 35.0 1.0 9.0 8.5 3.5
187 0 1 56.7 35.0 1.0 9.0 8.5 3.5
188 0 1 56.0 34.0 1.0 9.0 7.5 3.5
189 0 1 55.0 34.0 1.0 9.0 7.5 3.5
190 0 1 55.5 34.0 1.0 9.0 7.5 3.5
191 0 1 55.2 34.0 1.0 9.0 7.5 3.5
192 0 1 59.0 37.0 1.0 9.0 8.5 3.5
193 0 1 62.2 42.0 1.0 9.5 8.0 8.5
194 0 1 61.8 42.0 1.0 9.5 8.0 8.5
195 0 1 60.2 41.0 1.0 9.5 8.0 8.5
196 0 1 63.7 41.0 1.0 9.5 8.0 8.5
197 0 1 60.2 37.0 1.0 8.5 8.0 8.5
198 0 1 64.2 42.0 1.0 9.5 9.0 8.5
199 0 1 63.0 40.0 1.0 8.5 8.0 8.5
200 0 1 61.5 38.5 1.0 8.5 8.0 8.5
201 0 1 61.7 38.5 1.0 8.5 8.0 8.5
202 0 1 62.0 38.5 1.0 8.5 8.0 8.5
203 0 1 62.0 38.5 1.0 8.5 8.0 8.5
204 0 1 62.2 38.5 1.0 8.5 8.0 8.5
205 0 1 61.5 38.5 1.0 8.5 8.0 8.5
206 0 1 61.2 38.0 1.0 8.5 8.0 8.5
207 0 1 60.5 38.0 1.0 8.5 8.0 8.5
208 0 1 61.0 38.0 1.0 8.5 8.0 8.5
209 0 1 61.5 38.0 1.0 8.5 8.0 8.5
210 0 1 61.7 38.0 1.0 8.5 8.0 8.5
211 0 1 62.0 38.0 1.0 8.5 8.0 8.5
212 0 1 61.7 38.0 1.0 8.5 8.0 8.5
213 0 1 61.5 38.0 1.0 8.5 8.0 8.5
214 0 1 61.2 38.0 1.0 8.5 8.0 8.5
215 0 1 63.7 40.5 1.0 8.0 9.0 8.5
216 0 1 63.7 40.5 1.0 8.0 9.0 8.5
217 0 1 63.7 40.5 1.0 8.0 9.0 8.5
218 0 1 65.7 43.5 1.0 9.5 8.5 9.5
219 0 1 65.5 43.5 1.0 9.5 8.5 9.5
220 0 1 65.5 43.5 1.0 9.5 8.5 9.5
221 0 1 65.0 43.5 1.0 9.5 8.5 9.5
222 0 1 65.0 43.5 1.0 9.5 8.5 9.5
223 0 1 65.0 43.5 1.0 9.5 8.5 9.5
224 0 1 66.2 43.5 1.0 10.0 9.5 8.0
225 0 1 66.2 43.5 1.0 10.0 9.5 8.0
226 0 1 66.2 43.5 1.0 10.0 9.5 8.0
227 0 1 66.0 44.0 1.0 10.0 9.5 8.5
228 0 1 65.7 44.0 1.0 10.0 9.5 8.5
229 0 1 65.5 43.5 1.0 9.5 9.5 8.5
230 0 1 65.5 43.0 1.0 10.0 9.0 8.5
231 0 1 65.5 43.0 1.0 10.0 9.0 8.5
232 0 1 68.2 43.0 1.0 10.0 9.0 8.5
233 0 1 71.5 44.5 1.0 10.0 9.0 9.5
234 0 1 71.7 44.5 1.0 10.0 9.0 9.5
235 0 1 73.2 44.5 1.0 10.0 9.0 9.5
236 0 1 74.7 44.5 1.0 10.0 9.0 9.5
237 0 1 74.7 44.5 1.0 10.0 9.0 9.5
238 0 1 74.7 44.5 1.0 10.0 9.0 9.5
239 0 1 75.5 45.0 1.0 10.0 9.0 10.0
240 0 1 75.5 45.0 1.0 10.0 9.0 10.0
241 0 1 76.0 45.0 1.0 10.0 9.0 10.0
242 0 1 76.7 44.5 1.0 10.0 8.5 10.0
243 0 1 76.7 44.5 1.0 10.0 8.5 10.0
244 0 1 76.7 44.5 1.0 10.0 8.5 10.0
245 0 1 78.0 44.5 1.0 10.0 8.5 10.0
246 0 1 78.0 44.5 1.0 10.0 8.5 10.0
247 0 1 77.0 44.5 1.0 10.0 8.5 10.0
248 0 1 77.2 44.5 1.0 10.0 8.5 10.0
249 0 1 77.2 44.5 1.0 10.0 8.5 10.0
250 0 1 77.7 44.5 1.0 10.0 8.5 10.0
Here is your answer:
test.bic.surv <- bic.surv(
x[, 3:ncol(x)],
x$crisis1, x$cen1, factor.type=FALSE, strict=FALSE, nbest=2000, maxCol=50
)
You have to provide maxCol parameter. Default is 30 so it is probably not enough for your needs.

Resources