Re: [R] [FORGED] Re: Value Labels: SPSS Dataset to R

2020-02-07 Thread Rolf Turner
Dear Yawo, I would suggest that you learn to use R, rather than thrashing around blindly and expecting or hoping to get others to do your work for you. To get you started, the characteristics that you call "labels" are stored as *attributes* of the columns of your tibble/data frame. E.g.

Re: [R] Value Labels: SPSS Dataset to R

2020-02-07 Thread Yawo Kokuvi
Thanks for all. Here is output from dput. I used a different dataset containing categorical variables since the previous one is on a different computer. In the following dataset, my interest is in getting frequencies and barplots for the two variables: Training and Dance, with value labels displa

Re: [R] Value Labels: SPSS Dataset to R

2020-02-07 Thread Bert Gunter
Yes. Most attachments are stripped by the server. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Fri, Feb 7, 2020 at 5:34 PM John Kane wrote: > Hi, > Could y

Re: [R] Value Labels: SPSS Dataset to R

2020-02-07 Thread John Kane
Hi, Could you upload some sample data in dput form? Something like dput(head(Scratch, n=13)) will give us some real data to examine. Just copy and paste the output of dput(head(Scratch, n=13))into the email. This is the best way to ensure that R-help denizens are getting the data in the exact form

Re: [R] Value Labels: SPSS Dataset to R

2020-02-07 Thread Heinz Tuechler
Maybe it helps searching at https://rseek.org/ for "SPSS to R transition value labels". In particular https://cran.r-project.org/web/packages/expss/vignettes/labels-support.html seems useful, as well as https://www.r-bloggers.com/migrating-from-spss-to-r-rstats/ best regards, Heinz Jim Lemon wro

Re: [R] Value Labels: SPSS Dataset to R

2020-02-07 Thread Yawo Kokuvi
Thanks Jim: So one option is to go through the data, select all the categorical variables I want and re-define them as factor variables ? As in the following example for gender? mydata$sex<- factor(mydata$sex, levels = c(1,2), labels = c("male", "female")) thanks - cY On Fri, Feb 7, 2020 at 4:

Re: [R] Value Labels: SPSS Dataset to R

2020-02-07 Thread Jim Lemon
Hi Yawo, >From your recent post, you say you have coerced the variables to factors. If so, perhaps: as.character(x) is what you want. If not, creating a new variable like this: Scratch$new_race<-factor(as.character(Scratch$race),levels=c("WHITE","BLACK")) may do it. Note the "levels" argument t

Re: [R] Value Labels: SPSS Dataset to R

2020-02-07 Thread Yawo Kokuvi
Thanks for all your assistance Attached please is the Rdata scratch I have been using - > head(Scratch, n=13) # A tibble: 13 x 6 ID maritalsex racepaeducspeduc 1 1 3 [DIVORCED] 1

Re: [R] Plotting DMRs (Differentially Methylated Regions) using Gviz package in R

2020-02-07 Thread pooja sinha
Thanks, I'll check it out. On Fri, Feb 7, 2020 at 1:08 PM Martin Morgan wrote: > Probably have more success asking on https://support.bioconductor.org. > > Martin Morgan > > On 2/7/20, 12:57 PM, "R-help on behalf of pooja sinha" < > r-help-boun...@r-project.org on behalf of pjsinh...@gmail.com>

Re: [R] Plotting DMRs (Differentially Methylated Regions) using Gviz package in R

2020-02-07 Thread Martin Morgan
Probably have more success asking on https://support.bioconductor.org. Martin Morgan On 2/7/20, 12:57 PM, "R-help on behalf of pooja sinha" wrote: Hi All, I have a file list consisting of Chromosome, Start , End & Methylation Difference in the following format in excel:

[R] Plotting DMRs (Differentially Methylated Regions) using Gviz package in R

2020-02-07 Thread pooja sinha
Hi All, I have a file list consisting of Chromosome, Start , End & Methylation Difference in the following format in excel: Chrom Start End Meth. Diff chr1 38565900 38566000 -0.20276818 chr1 38870400 38870500 -0.342342342 chr1 39469400 39469500 -0.250260552 c

Re: [R] Value Labels: SPSS Dataset to R

2020-02-07 Thread Bert Gunter
What does your data look like after importing? -- see ?head and ?str to tell us. Show us the code that failed to provide "labels." See the posting guide below for how to post questions that are likely to elicit helpful responses. I know nothing about the haven package, but see ?factor or go throug

[R] Value Labels: SPSS Dataset to R

2020-02-07 Thread Yawo Kokuvi
Hello, I am just transitioning from SPSS to R. I used the haven library to import some of my spss data files to R. However, when I run procedures such as frequencies or crosstabs, value labels for categorical variables such as gender (1=male, 2=female) are not shown. The same applies to many oth

[R] k-nearest neighbours from distance matrix in spdep

2020-02-07 Thread Juan Antonio Rodriguez Perez
Dear all, I am using the spdep package to compute Local Moran Index. My problem is that I am using 3D coordinates (x,y,z), and I would like to compute the k-nearest neighbours (k=10) for each point in my 3D space. I have already done this in 2D, by doing the following: >neighs_k <- knn2nb(kn