3

I'm trying to read in a (tab separted) csv file in R. When I want to read the column including a /, I get an error.

doSomething <- function(dataset) {
     a <- dataset$data_transfer.Jingle/TCP.total_size_kb
     ...
     }

The error says, that this object cannot be found. I've tried escaping with backslash but it did not work.

If anybody has got some idea, I'd really appreciate it!

2 Answers 2

2

Give

head(dataset)

and watch the name it has been given. Perhaps it would be something like:

dataset$data_transfer.Jingle.TCP.total_size_kb
Sign up to request clarification or add additional context in comments.

Comments

1

Two ways:

dataset[["data_transfer.Jingle/TCP.total_size_kb"]]

or

dataset$`data_transfer.Jingle/TCP.total_size_kb`

1 Comment

This is really helpful if the variable name in the dataset really does have a forward slash (assigned in some way other than direct import).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.