Nemo
Nemo

Reputation: 35

Retrieving elements based on object

I have a dataframe that looks a little like this:
slide     | title       | text
defautlt | No title | No text

With the top row being the header. I then want to retrieve the title value with this code.

text = "default"
slideText[slideText$slide == text,]$title 

This return character(0)

But when I use slideText[slideText$slide == "default",]$title

It return "No title" as intended.

Upvotes: 1

Views: 34

Answers (2)

Nemo
Nemo

Reputation: 35

This turned out to work: slideText[slideText$slide == text,'title']

Thanks to dvd280

Upvotes: 0

dvd280
dvd280

Reputation: 962

Try :

slideText[slideText$slide == text,'title']

Upvotes: 2

Related Questions