Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7707585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:23:52+00:00 2026-06-01T00:23:52+00:00

I am reading a dataset with the following code from the directory: df= read.csv(‘101_E424690_N566610.csv’,

  • 0

I am reading a dataset with the following code from the directory:

df= read.csv('101_E424690_N566610.csv',  skip = 6)

then changing the names:

         colnames(df) = c("type","date","v1","v2","v3","v4","v5","v6","v7","v8","v9","v10","v11","v12","v13","v14","v15","v16","v17","v18","v19","v20","v21","v22","v23","v24","total")

I am trying to split the file name as it has the ID number, easting and northing and add 3 additional coloumn after “Type” and “data” coloumn before starting “V1”, “V2” etc., I have got some code but I think what I am doing is not right, the codes I am trying is:

split <- strsplit(df,"_") 
     gsub('df', '', lapply(split, '[', 2))

What I am trying to get is to create 3 additional coloumn and paste ID = 101, Easting = 424690, and Northing = 566610.

is this possible with R?

Many thanks,
Ayan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T00:23:53+00:00Added an answer on June 1, 2026 at 12:23 am

    Ayan, remember to give reproducible examples. One solution to have your columns after the date column:

    df=data.frame(type="T",date="D",v=rnorm(10),total=1:10)
    s = strsplit("101_E424690_N566610","_",fixed=TRUE)[[1]]
    cbind(df[,c("type","date")],ID=s[1],Easting=s[2],Northing=s[3],df[,3:ncol(df)])
    
       type date  ID Easting Northing         v total
    1     T    D 101 E424690  N566610  0.136314     1
    2     T    D 101 E424690  N566610 -0.696407     2
    3     T    D 101 E424690  N566610  0.057647     3
    4     T    D 101 E424690  N566610  0.110771     4
    5     T    D 101 E424690  N566610  0.397276     5
    6     T    D 101 E424690  N566610 -0.440799     6
    7     T    D 101 E424690  N566610  0.909284     7
    8     T    D 101 E424690  N566610  0.007315     8
    9     T    D 101 E424690  N566610  0.407037     9
    10    T    D 101 E424690  N566610 -0.337159    10
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a CSV dataset config element, which is reading from a file like
I've the following expression in my report. =FormatNumber(MAX(Fields!Reading.Value, CellReading_Reading),3) Now when the dataset is
I need to read from a dataset which is very large, highly interlinked, the
I am reading in an XML file into a Dataset, then adding a new
I'm reading data from XML files into a strong typed DataSet . The data
I'm using the following code to import a simple excel spreadsheet into a dataset
I have a requirement for B2B integration, I will reading flat table from dataset
I am reading an XML file into a DataSet and need to get the
Reading this question I found this as (note the quotation marks) code to solve
Reading source code of sample projects, such as Beast and Bort, are recommended as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.