0
output$Table <- 
    renderTable(
      myData()%>%mutate(searchmatch<-str_extract(DocumentText,"([^\\s]+\\s){50}to treat(\\s[^\\s]+){50}"))
     )

This final section of my code searches 'DocumentText' for a character string and adds it into a new column. I would like to drop the 'DocumentText' column after the new column is added as it is very large, I have tried using select(myData,-DocumentText) but this didn't work. I also tried using myData([-2],) bu this also failed; Any suggestions would be great

3
  • What object is myData? Is it a function? If it is a dataframe, then myData[-2] or myData[, -2] Commented Nov 29, 2019 at 10:33
  • 1
    myData is a dataframe Commented Nov 29, 2019 at 10:38
  • 1
    Please add a reproducible example so that you are more likely to get help from others. Commented Nov 29, 2019 at 10:58

1 Answer 1

1

Alternatively, have you tried

output$Table <- 
    renderTable(
      myData() %>% 
      mutate(searchmatch = str_extract(DocumentText,"([^\\s]+\\s){50}to 
      treat(\\s[^\\s]+){50}")) %>% 
      select(-DocumentText)
     )
Sign up to request clarification or add additional context in comments.

Comments

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.