我在Ubuntu 18.04上通过conda安装R。
Use of unresolved identifier 'self'
运行正常。 它将安装3.6.1而不是3.6.0。然后,例如,当我使用R时,安装不在conda上的软件包;
import Foundation
import Combine
import SwiftUI
public class MessageData: ObservableObject, Identifiable {
public var peerData: [Peer] = [Peer]()
public var messageData: [Message] = [Message]()
public var objectWillChange = PassthroughSubject<Void, Never>()
let subscribe = NotificationCenter.default.publisher(for: Notification.Name(rawValue: "LocalTalkNotificationReceivedData"), object: nil)
.map( {
($0.object as! Data)
} )
.sink(receiveValue: {
self.interpretIncoming(data: $0)
})
init() {
self.setupDummyData()
}
private func setupDummyData() {
self.peerData = self.load("peerData.json")
self.messageData = self.load("messageData.json")
}
func addMessage(message: String, sender: MessageSource, name: String) {
let newMessage = Message(id: Date().hashValue,
content: message,
source: sender,
correspondent: name)
self.messageData.append(newMessage)
self.objectWillChange.send()
}
func load<T: Decodable>(_ filename: String, as type: T.Type = T.self) -> T {
let data: Data
guard let file = Bundle.main.url(forResource: filename, withExtension: nil)
else {
fatalError("Couldn't find \(filename) in main bundle.")
}
do {
data = try Data(contentsOf: file)
} catch {
fatalError("Couldn't load \(filename) from main bundle:\n\(error)")
}
do {
let decoder = JSONDecoder()
return try decoder.decode(T.self, from: data)
} catch {
fatalError("Couldn't parse \(filename) as \(T.self):\n\(error)")
}
}
func interpretIncoming(data sent: Data) {
do {
let receivedTransmission = try NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(sent) as! [String: Any]
self.addMessage(message: receivedTransmission["messagePayload"] as! String,
sender: .them,
name: receivedTransmission["messageSender"] as! String)
} catch {
print("FAILED DECODING THING")
}
}
我收到此错误:
v=3.6.0
conda create -n env-r${v} -c r r=${v} r-ggplot2 r-gridExtra r-gtable r-tidyr r-devtools
conda activate env-r${v}
如果我打开R并在其中运行内容,则会出现更多错误:
Rscript -e 'install.packages("label.switching", repos="https://cran.rstudio.com")'
运行conda 4.7.5。
在R内运行Error in path.expand(new) : object 'lb' not found
Calls: .First ... .libPaths -> Sys.glob -> path.expand -> path.expand
Execution halted
。
Error in path.expand(new) : object 'lb' not found
Calls: .First ... .libPaths -> Sys.glob -> path.expand -> path.expand
Execution halted
Error in i.p(...) :
(converted from warning) installation of package ‘rlang’ had non-zero exit status