Beginner problem with variables number

rstudio
#1

Hi
I'm struggling with Rstudio but I'm a total beginner so it's probably really easy to solve. So easy that I can't find it explained on internet!!

I do this:

dframe1 <- read.csv(file.choose())

summary(dframe1)
names(dframe1)
str(dframe1)

my file is correct, I can see it but R says 200 observations of 1 variable despite there is 12 columns in my file and I was expecting 12 variables
How can I make it work?

Thank you!!

0 Likes

#2

Are you sure that your file has comma separated values? maybe it has another format, please paste a few lines from the file to take a look into its structure.

0 Likes

#3

summary(dframe1)
Individual.Size.Territory.Coral.Algae.Attack.Visitor.Diet.Farming.Exploring..Defending.Other
30;5;>1m;10;10;0;Abudefduf;Omnivore;60;94;9;17 : 5
44;5;<1m;0;30;0;Abudefduf;Omnivore;39;94;0;47 : 5
30;5;>1m;10;10;1;Pomacentrus;Algivore;60;94;9;17 : 4

Like this? Thank you for your reply!

0 Likes

#4

It seems like your values are separeted by ";" instead of ","
Try reading your file with this

dframe1 <- read.csv(file.choose(), sep = ";")
1 Like

#5

Oh my god you did it!! Thank you, I spent like 4 hours trying everything!!

0 Likes

#6

Your welcome!

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

0 Likes

closed #7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.

0 Likes