mapPies function

68 views
Skip to first unread message

aureli...@enix.org

unread,
Nov 11, 2015, 1:39:40 AM11/11/15
to rworldmap
Good morning,

I'm a new user of R and I would like to create a map with genotype frequency using pies chart

My data are in a .csv file.
I imported it in R using this command :
 data <- read.table ("datacarte.csv", sep=",", header = TRUE)
attributes (data)
$names
[1] "countryname"   "ISOcountry"       "genotype1"        "genotype2"        "genotype3"        "effectifs"
[7] "genotype1freq"      "genotype2fred"      "genotype3freq"    
$class
[1] "data.frame"
$row.names
 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
[26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
[51] 51 52 53 54 55 56 57 58 59 60 61 62

I loaded the package rworldmap

I joined my country data
> sPDF <- joinCountryData2Map (data
+ ,joinCode = "ISO2"
+ , nameJoinColumn = "ISOcountry")

Then I tried to obtain the map :
>mapDevice ()
> dF <- data
> mapPies (dF = dF
+ , nameZs = c("genotype1freq", "genotype2freq","genotype3freq")
+ , mapRegion = "world")
symbolMaxSize= 7.2  maxSumValues= 100.01  symbolScale= 0.719964
List of 2
 $ x: num [1:100] -158 -158 -158 -159 -159 ...
 $ y: num [1:100] 72.2 72.6 73.1 73.5 74 ...

But I have nothing on my map.
I don't understand where come from my mystake.

Thank you for your help
Aurélie


Jean-Baka Domelevo Entfellner

unread,
Nov 11, 2015, 2:30:42 AM11/11/15
to aureli...@enix.org, rworldmap
Hello Aurélie, all,
I guess the first argument to mapPies should be the sPDF object you created by joinCountryData2Map, not the original data frame you called "data" or "dF".
Regards,
JB

aureli...@enix.org wrote:
--
You received this message because you are subscribed to the Google Groups "rworldmap" group.
To post to this group, send email to rwor...@googlegroups.com.
Visit this group at http://groups.google.com/group/rworldmap.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rworldmap/4c5bfacd-62e0-4c37-a798-9582b1dc572a%40googlegroups.com.
Sent Using Firefox OS

aureli...@enix.org

unread,
Nov 11, 2015, 2:35:33 AM11/11/15
to rworldmap, aureli...@enix.org
Thank you so much !
It works

Aurélie
Reply all
Reply to author
Forward
0 new messages