in R, can I stop print(cat(“”)) from returning NULL? and why does cat(“foo”) return foo>

后端 未结 6 690
-上瘾入骨i
-上瘾入骨i 2021-02-18 20:16

If I enter

print(cat(\"\"))

I get

NULL

I want to use cat() to print out the progress of an R sc

6条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-18 20:41

    If you want to assign it to a variable, for use in a LOOP of *apply or function (x), try this:

    x<-eval(paste0(name,".y"))
    

    The name is the variable, the ".y" adds a string to it, paste says to print in, eval evaluates the print, <- assigns it to a variable, and ax is that variable.

提交回复
热议问题