Q:

Write a R program to create an empty data frame

0

Write a R program to create an empty data frame.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

df = data.frame(Ints=integer(),
                Doubles=double(),
                Characters=character(),
                Logicals=logical(),
                Factors=factor(),
                stringsAsFactors=FALSE)
print("Structure of the empty dataframe:")
print(str(df))

Sample Output:

[1] "Structure of the empty dataframe:"
'data.frame':	0 obs. of  5 variables:
 $ Ints      : int 
 $ Doubles   : num 
 $ Characters: chr 
 $ Logicals  : logi 
 $ Factors   : Factor w/ 0 levels: 
NULL

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now