python中R的输入函数的等价物是什么?

python中R的输入函数的等价物是什么?,r,R,在python中,函数输入与变量赋值一起使用。我有一个代码,其中我将用户的输入分配给变量output和state,但R将不接受该函数。这在R中的等价物是什么,请给出一个例子 best <- function(state, outcome) { #read file function dataTable <- read.csv("outcome.csv", header = TRUE) choice <- state stateOfChoice <-

在python中,函数输入与变量赋值一起使用。我有一个代码,其中我将用户的输入分配给变量output和state,但R将不接受该函数。这在R中的等价物是什么,请给出一个例子

best <- function(state, outcome) {
     #read file function
  dataTable  <- read.csv("outcome.csv", header = TRUE)
  choice <- state
  stateOfChoice <- dataTable[which(dataTable$state == choice),]

  if (outcome == "heart attack"){
    #subsetting,selecting column of "Lower mortality estimate [xxxSpecified  Outcomexxx ]"  & the Hospital name attach to it
    heart_attack <- outcome[which.min(outcome$Lower.Mortality.Estimate...Hospital.30.Day.Death..Mortality..Rates.from.Heart.Attack),]
    name <- heart_attack$state
    hospital <- heart_attack$Hospital.Name
  }
  return(hospital)

}


main <- function() {
  print("Type Heart Attack, .....")

  outcome <- input("Type your selection")

  print("Select state")

  state <- input("Type in your selection")

  best(state,outcome)
}

main()

在R中,这将是readline

e、 g

> name <- readline(prompt="Enter name: ")
Enter name: Blah Blah
> paste0(name)
[1] "Blah Blah"