madmaxthc madmaxthc - 1 year ago 106
R Question

Using vectors as input to dataframe

Sorry I couldn't find a better title, I'll try to make my question a bit clearer:

# my input:
test_character<- 'name1'
conditions<- c(TRUE, FALSE, FALSE)
#
#My line
myDF<- data.frame(test_character, conditions)


What I get is a dataframe with 2 columns, one of which is
test_character
(repeated in 3 rows) and the other is
conditions
.
What I want is a single row with 4 columns. Please advise ;)

Answer Source
mydf <- data.frame(test_character, t(conditions))
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download