0

This is my problem:

this part of my script works:

paste(fileIn$DOY_L8,fileIn$type, sep="")

but not in this way

sat = "L8"
paste(fileIn$(paste("DOY_",sat,sep="")),fileIn$type, sep="")

The question is: it is possible to use the function "paste" after the $ ??

Thank you very much

1 Answer 1

1

It is not possible to use paste function like that. To get what you want, you can break it in two steps:

  • Create a variable that has the name of the column you want to derive. If sat<-'L8' then,

    col1<-paste("DOY_", sat, sep="")
    
  • Now you can use:

    fileIn[,col1]
    
Sign up to request clarification or add additional context in comments.

3 Comments

Dear Max, I know I look stupid, but I'm new in this community and I don't know how to quote your answer. Any hint? Thank you
:) There is a tick next to my answer on the left. near the 0
Wow, I can see the up and down arrows above and below the 0 only if I open the website in chrome. Anyway I think I voted. Do you confirm this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.