Hello

I am novice to R and i was learning how to do a scatter plot with R using
an example from a website.

My setup is iMac with Mac OS X 10.8.3, with R 3.0.1, default install,
without additional packages loaded

I created a .csv file in vim with  the following content
userID,user,posts
1,user1,581
2,user2,281
3,user3,196
4,user4,150
5,user5,282
6,user6,184
7,user7,90
8,user8,74
9,user9,45
10,user10,20
11,user11,3
12,user12,1
13,user13,345
14,user14,123

i imported the file into R using : ' df <- read.csv('file.csv')
to confirm the data types i did : 'sappily(df, class) '
that returns "userID" --> "integer" ; "user" ---> "factor" ; "posts" --->
"integer"
then i try to create another data frame with the number of posts and its
frequencies,
so i did: 'postFreqCount<-data.frame(table(df['posts']))'
this gives me the postFreqCount data frame with two columns, one called
'Var1' that has the number of posts each user did, and another collumn
'Freq' with the frequency of each number of posts.
the problem is that if i do : 'sappily(postFreqCount['Var1'],class)' it
returns "factor".
So the data.frame() function transformed a variable that was "integer"
(posts) to a variable (Var1) that has the same values but is "factor".
I want to know how to prevent this from happening. How do i keep the values
from being transformed from "integer" to "factor" ?

Thank you for your help

António

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to