psych

psych: principal - loadings components

为君一笑 提交于 2019-11-30 21:44:51
My question is concerned with the principal() function in psych package. set.seed(0) x <- replicate(8, rnorm(10)) pca.x <- principal(x, nf=4, rotate="varimax") I know if I want to see the loadings table, I can use loading.x <-loadings(pca.x) , than I will have the following results. > loading.x Loadings: RC1 RC3 RC4 RC2 [1,] -0.892 -0.205 0.123 [2,] 0.154 0.158 0.909 [3,] -0.660 0.255 -0.249 0.392 [4,] -0.352 0.412 0.614 -0.481 [5,] 0.950 -0.208 0.117 [6,] -0.302 0.111 0.860 [7,] 0.852 -0.195 -0.358 [8,] -0.109 0.903 0.265 RC1 RC3 RC4 RC2 SS loadings 2.323 1.934 1.373 1.342 Proportion Var 0

psych: principal - loadings components

删除回忆录丶 提交于 2019-11-30 17:17:43
问题 My question is concerned with the principal() function in psych package. set.seed(0) x <- replicate(8, rnorm(10)) pca.x <- principal(x, nf=4, rotate="varimax") I know if I want to see the loadings table, I can use loading.x <-loadings(pca.x) , than I will have the following results. > loading.x Loadings: RC1 RC3 RC4 RC2 [1,] -0.892 -0.205 0.123 [2,] 0.154 0.158 0.909 [3,] -0.660 0.255 -0.249 0.392 [4,] -0.352 0.412 0.614 -0.481 [5,] 0.950 -0.208 0.117 [6,] -0.302 0.111 0.860 [7,] 0.852 -0.195

Documentation for Psych to_yaml options?

放肆的年华 提交于 2019-11-30 10:54:42
Ruby 1.9.3 defaults to using Psych for YAML. While the ruby-doc documentation for it is completely lacking , I was able to find one external piece of documentation that hinted that the indentation option is supported. This was borne out in testing: irb(main):001:0> RUBY_VERSION #=> "1.9.3" irb(main):002:0> require 'yaml' #=> true irb(main):003:0> [[[1]]].to_yaml #=> "---\n- - - 1\n" irb(main):009:0> [[[1]]].to_yaml indentation:9 #=> "---\n- - - 1\n" There are presumably more options supported. Specifically, I want to know how to change the line wrap width or disable it altogether. What are the

Installing libyaml for ruby on a mac osX (Lion)

南楼画角 提交于 2019-11-30 10:00:38
I am getting this error message: "It seems your ruby installation is missing psych (for YAML output). To eliminate this warning, please install libyaml and reinstall your ruby." I have tried entering this command: rvm pkg install libyaml and I am getting this error message: "Fetching yaml-0.1.4.tar.gz to /Users/luke/.rvm/archives Extracting yaml-0.1.4.tar.gz to /Users/luke/.rvm/src Error running 'tar xmzf /Users/luke/.rvm/archives/yaml-0.1.4.tar.gz -C /Users/luke/.rvm/src ', please read /Users/luke/.rvm/log/yaml/extract.log Configuring yaml in /Users/luke/.rvm/src/yaml-0.1.4. Error running ' .

Having trouble installing any ruby 1.9.x (with rbenv) on mac osx due to psych YAML parse errors

瘦欲@ 提交于 2019-11-29 16:59:29
I tried to get rvm uninstalled in order to use rbenv on my Mac. Everything works fine until ruby comes into play.. when using rbenv install 1.9.3-p194 it compiles it correctly, but after that I'd like to install bundler.. this produces the following error computer:~ computer$ gem install bundler /Users/computer/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/psych.rb:203:in `parse': (<unknown>): mapping values are not allowed in this context at line 1 column 34 (Psych::SyntaxError) from /Users/computer/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/psych.rb:203:in `parse_stream' from /Users/computer/

Documentation for Psych to_yaml options?

旧街凉风 提交于 2019-11-29 16:08:55
问题 Ruby 1.9.3 defaults to using Psych for YAML. While the ruby-doc documentation for it is completely lacking , I was able to find one external piece of documentation that hinted that the indentation option is supported. This was borne out in testing: irb(main):001:0> RUBY_VERSION #=> "1.9.3" irb(main):002:0> require 'yaml' #=> true irb(main):003:0> [[[1]]].to_yaml #=> "---\n- - - 1\n" irb(main):009:0> [[[1]]].to_yaml indentation:9 #=> "---\n- - - 1\n" There are presumably more options supported

How can I emit comments in a YAML document using Psych? [duplicate]

让人想犯罪 __ 提交于 2019-11-29 15:43:25
This question is an exact duplicate of: Adding comment to YAML programmatically 1 answer I want to generate a YAML document with some comments between sequence elements but I can't really figure out how to do this. Any pointers? You can’t emit YAML documents containing comments with Psych. Psych basically dumps a Hash, and you can’t have comments in a Hash either. 来源: https://stackoverflow.com/questions/16889044/how-can-i-emit-comments-in-a-yaml-document-using-psych

How to dump strings in YAML using literal scalar style?

孤街浪徒 提交于 2019-11-28 12:31:35
I have a big string of formatted data (e.g. JSON) that I want to dump to YAML using Psych in ruby while preserving formatting . Basically, I want for JSON to appear in YAML using literal style : --- json: | { "page": 1, "results": [ "item", "another" ], "total_pages": 0 } However, when I use YAML.dump it doesn't use literal style. I get something like this: --- json: ! "{\n \"page\": 1,\n \"results\": [\n \"item\", \"another\"\n ],\n \"total_pages\": 0\n}\n" How can I tell Psych to dump scalars in wanted style? Solution: Big thanks to Aaron Patterson for his solution that I'm expanding on here

How can I emit comments in a YAML document using Psych? [duplicate]

一个人想着一个人 提交于 2019-11-28 09:43:16
问题 This question already has an answer here : Adding comment to YAML programmatically (1 answer) Closed 4 years ago . I want to generate a YAML document with some comments between sequence elements but I can't really figure out how to do this. Any pointers? 回答1: You can’t emit YAML documents containing comments with Psych. Psych basically dumps a Hash, and you can’t have comments in a Hash either. 来源: https://stackoverflow.com/questions/16889044/how-can-i-emit-comments-in-a-yaml-document-using

Read and write YAML files without destroying anchors and aliases

帅比萌擦擦* 提交于 2019-11-26 21:57:38
问题 This question has been asked before: Read and write YAML files without destroying anchors and aliases? I was wondering how to solve that problem with many anchors and aliases? thanks 回答1: The problem here is that anchors and aliases in Yaml are a serialization detail, and so aren’t part of the data after it’s been parsed, so the original anchor name isn’t known when writing the data back out to Yaml. In order to keep the anchor names when round tripping you need to store them somewhere when