Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
179 views
in Technique[技术] by (71.8m points)

excel - R read_excel: How to associate range=cell_cols and cell_type

This is the question.

I have an excel file to import with read_excel function. 42 columns. Firts two columns are Date and Time, the following, from 3 to 42, data (numeric).

I want to select two ranges of columns, es range=cell_cols(c('A:B', 'C:AP')) and associate them to two different col_types, es col_types=(c('date','numeric')). Avoiding to types 2 date and 40 times 'numeric'.

I tried this code: read_excel("D:/R/File_xls/TOF_Bioquar/July_Fluxes.xlsx",range=cell_cols(c('A:B','C:AP')),col_types=(c('date','numeric')), sheet = 1), but it gives me an error. Error: Sheet 1 has 42 columns, but col_types has length 2.

I searched online before writing here, but I did not found solution. It is possible? Thanks


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...